@@ -11,6 +11,8 @@ permissions:
1111jobs :
1212 update-version :
1313 runs-on : ubuntu-latest
14+ outputs :
15+ version : ${{ steps.process_version.outputs.version }}
1416 permissions :
1517 contents : write
1618 pull-requests : write
@@ -19,26 +21,38 @@ jobs:
1921 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2022 with :
2123 ref : develop
24+ fetch-depth : 0
25+ fetch-tags : true
2226
2327 - name : Get version
2428 id : get_version
2529 run : |
26- if [ "${{ github.event_name } }" = "release" ]; then
27- VERSION="${{ github.event.release.tag_name }}"
30+ if [ "${EVENT_NAME }" = "release" ]; then
31+ echo "version=${RELEASE_TAG}" >> $GITHUB_OUTPUT
2832 else
29- VERSION=$(gh release list --limit 1 --json tagName -q '.[0].tagName')
33+ VERSION=$(git describe --tags --abbrev=0)
34+ echo "version=${VERSION}" >> $GITHUB_OUTPUT
3035 fi
31-
36+ env :
37+ EVENT_NAME : ${{ github.event_name }}
38+ RELEASE_TAG : ${{ github.event.release.tag_name }}
39+
40+ - name : Process version
41+ id : process_version
42+ run : |
43+ VERSION="${RAW_VERSION}"
3244 # Remove 'v' prefix if present
3345 VERSION="${VERSION#v}"
3446
3547 echo "VERSION=${VERSION}" >> $GITHUB_ENV
3648 echo "version=${VERSION}" >> $GITHUB_OUTPUT
3749 env :
38- GH_TOKEN : ${{ github.token }}
50+ RAW_VERSION : ${{ steps.get_version.outputs.version }}
3951
4052 - name : Write version to version.txt
41- run : echo "${{ env.VERSION }}" > version.txt
53+ run : echo "${VERSION}" > version.txt
54+ env :
55+ VERSION : ${{ steps.process_version.outputs.version }}
4256
4357 - name : Check if changes exist
4458 id : check_changes
6276 This PR updates version.txt to the latest release version.
6377
6478 **Version**: ${{ env.VERSION }}
65- **Release**: ${{ github.event_name == 'release' && github.event.release.html_url || format('https://github.com/{0}/releases/tag/{1}', github.repository, env.VERSION) }}
79+ **Release**: ${{ github.event_name == 'release' && github.event.release.html_url || format('https://github.com/{0}/releases/tag/v {1}', github.repository, env.VERSION) }}
6680 **Triggered by**: ${{ github.event_name }}
6781 labels : automation,version-update
6882 delete-branch : true
0 commit comments