Update version naming in GitHub Actions

The convention for naming versions in GitHub Actions was modified. Previously, all tags were assigned just a sequential version, even if they were already marked as a release by a tag. Now, if they are tagged and marked as a published release, they use the tag as the version. The change should provide more accurate version information.
This commit is contained in:
Sipke Schoorstra 2023-12-31 12:59:55 +01:00
parent 6ba6556cb4
commit 9c1ce0c82f

View file

@ -26,10 +26,10 @@ jobs:
git branch --remote --contains | grep origin/main
- name: Set VERSION variable
run: |
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
TAG_NAME=${{ github.ref }} # e.g., refs/tags/preview-740-hotfix-1
if [[ "${{ github.ref }}" == refs/tags/* && "${{ github.event_name }}" == "release" && "${{ github.event.action }}" == 'published']]; then
TAG_NAME=${{ github.ref }} # e.g., refs/tags/3.0.0
TAG_NAME=${TAG_NAME#refs/tags/} # remove the refs/tags/ prefix
echo "VERSION=3.0.0-preview-${TAG_NAME}.${{github.run_number}}" >> $GITHUB_ENV
echo "VERSION=${TAG_NAME}" >> $GITHUB_ENV
else
echo "VERSION=3.0.0-preview.${{github.run_number}}" >> $GITHUB_ENV
fi