From 8517ef7db9410f49e45990a9788ae1ebee575f54 Mon Sep 17 00:00:00 2001 From: Henrique Graca <999396+hjgraca@users.noreply.github.com> Date: Tue, 7 Oct 2025 15:47:56 +0100 Subject: [PATCH 1/5] chore: update version workflow to allow manual version input and fix version retrieval using tag --- .github/workflows/update_version.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update_version.yml b/.github/workflows/update_version.yml index 052b65a8..41bd5cd9 100644 --- a/.github/workflows/update_version.yml +++ b/.github/workflows/update_version.yml @@ -4,6 +4,11 @@ on: release: types: [published] workflow_dispatch: + inputs: + version: + description: 'Version to use (leave empty to use latest release)' + required: false + type: string permissions: contents: read @@ -11,6 +16,8 @@ permissions: jobs: update-version: runs-on: ubuntu-latest + outputs: + version: ${{ steps.get_version.outputs.version }} permissions: contents: write pull-requests: write @@ -23,10 +30,12 @@ jobs: - name: Get version id: get_version run: | - if [ "${{ github.event_name }}" = "release" ]; then + if [ -n "${{ inputs.version }}" ]; then + VERSION="${{ inputs.version }}" + elif [ "${{ github.event_name }}" = "release" ]; then VERSION="${{ github.event.release.tag_name }}" else - VERSION=$(gh release list --limit 1 --json tagName -q '.[0].tagName') + VERSION=$(git describe --tags --abbrev=0) fi # Remove 'v' prefix if present From acb54dd85ef1de1a316d5b31f525e1b4dc2cd4f3 Mon Sep 17 00:00:00 2001 From: Henrique Graca <999396+hjgraca@users.noreply.github.com> Date: Tue, 7 Oct 2025 15:54:03 +0100 Subject: [PATCH 2/5] fix: update version retrieval logic to use environment variables --- .github/workflows/update_version.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/update_version.yml b/.github/workflows/update_version.yml index 41bd5cd9..b22ef270 100644 --- a/.github/workflows/update_version.yml +++ b/.github/workflows/update_version.yml @@ -30,10 +30,10 @@ jobs: - name: Get version id: get_version run: | - if [ -n "${{ inputs.version }}" ]; then - VERSION="${{ inputs.version }}" - elif [ "${{ github.event_name }}" = "release" ]; then - VERSION="${{ github.event.release.tag_name }}" + if [ -n "${INPUT_VERSION}" ]; then + VERSION="${INPUT_VERSION}" + elif [ "${EVENT_NAME}" = "release" ]; then + VERSION="${RELEASE_TAG}" else VERSION=$(git describe --tags --abbrev=0) fi @@ -45,6 +45,9 @@ jobs: echo "version=${VERSION}" >> $GITHUB_OUTPUT env: GH_TOKEN: ${{ github.token }} + INPUT_VERSION: ${{ inputs.version }} + EVENT_NAME: ${{ github.event_name }} + RELEASE_TAG: ${{ github.event.release.tag_name }} - name: Write version to version.txt run: echo "${{ env.VERSION }}" > version.txt From 732f76f111334266f4845e230f67f955cce860ce Mon Sep 17 00:00:00 2001 From: Henrique Graca <999396+hjgraca@users.noreply.github.com> Date: Tue, 7 Oct 2025 15:58:55 +0100 Subject: [PATCH 3/5] fix: simplify version retrieval logic and remove unused input parameter --- .github/workflows/update_version.yml | 32 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/update_version.yml b/.github/workflows/update_version.yml index b22ef270..528daed6 100644 --- a/.github/workflows/update_version.yml +++ b/.github/workflows/update_version.yml @@ -4,11 +4,6 @@ on: release: types: [published] workflow_dispatch: - inputs: - version: - description: 'Version to use (leave empty to use latest release)' - required: false - type: string permissions: contents: read @@ -17,7 +12,7 @@ jobs: update-version: runs-on: ubuntu-latest outputs: - version: ${{ steps.get_version.outputs.version }} + version: ${{ steps.process_version.outputs.version }} permissions: contents: write pull-requests: write @@ -30,27 +25,32 @@ jobs: - name: Get version id: get_version run: | - if [ -n "${INPUT_VERSION}" ]; then - VERSION="${INPUT_VERSION}" - elif [ "${EVENT_NAME}" = "release" ]; then - VERSION="${RELEASE_TAG}" + if [ "${EVENT_NAME}" = "release" ]; then + echo "version=${RELEASE_TAG}" >> $GITHUB_OUTPUT else VERSION=$(git describe --tags --abbrev=0) + echo "version=${VERSION}" >> $GITHUB_OUTPUT fi - + env: + EVENT_NAME: ${{ github.event_name }} + RELEASE_TAG: ${{ github.event.release.tag_name }} + + - name: Process version + id: process_version + run: | + VERSION="${RAW_VERSION}" # Remove 'v' prefix if present VERSION="${VERSION#v}" echo "VERSION=${VERSION}" >> $GITHUB_ENV echo "version=${VERSION}" >> $GITHUB_OUTPUT env: - GH_TOKEN: ${{ github.token }} - INPUT_VERSION: ${{ inputs.version }} - EVENT_NAME: ${{ github.event_name }} - RELEASE_TAG: ${{ github.event.release.tag_name }} + RAW_VERSION: ${{ steps.get_version.outputs.version }} - name: Write version to version.txt - run: echo "${{ env.VERSION }}" > version.txt + run: echo "${VERSION}" > version.txt + env: + VERSION: ${{ steps.process_version.outputs.version }} - name: Check if changes exist id: check_changes From a45482a3e1e29d9b4b7f765d784e3230f360cc14 Mon Sep 17 00:00:00 2001 From: Henrique Graca <999396+hjgraca@users.noreply.github.com> Date: Tue, 7 Oct 2025 16:18:44 +0100 Subject: [PATCH 4/5] fix: ensure fetch-depth and fetch-tags are set for version retrieval --- .github/workflows/update_version.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/update_version.yml b/.github/workflows/update_version.yml index 528daed6..5d930409 100644 --- a/.github/workflows/update_version.yml +++ b/.github/workflows/update_version.yml @@ -21,6 +21,8 @@ jobs: uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 with: ref: develop + fetch-depth: 0 + fetch-tags: true - name: Get version id: get_version From 9428c8f909f111fba2b7e4c7dd487ff24a60cb15 Mon Sep 17 00:00:00 2001 From: Henrique Graca <999396+hjgraca@users.noreply.github.com> Date: Tue, 7 Oct 2025 16:20:48 +0100 Subject: [PATCH 5/5] fix: correct release URL format in PR commit message --- .github/workflows/update_version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update_version.yml b/.github/workflows/update_version.yml index 5d930409..095d2cf0 100644 --- a/.github/workflows/update_version.yml +++ b/.github/workflows/update_version.yml @@ -76,7 +76,7 @@ jobs: This PR updates version.txt to the latest release version. **Version**: ${{ env.VERSION }} - **Release**: ${{ github.event_name == 'release' && github.event.release.html_url || format('https://github.com/{0}/releases/tag/{1}', github.repository, env.VERSION) }} + **Release**: ${{ github.event_name == 'release' && github.event.release.html_url || format('https://github.com/{0}/releases/tag/v{1}', github.repository, env.VERSION) }} **Triggered by**: ${{ github.event_name }} labels: automation,version-update delete-branch: true