From 54e0f130a8f1f440ea0029f5c9ccfd186594622f Mon Sep 17 00:00:00 2001 From: Xianpeng Shen Date: Wed, 27 Aug 2025 22:42:56 +0300 Subject: [PATCH 1/2] fix: add contents write permission and force tag updates --- .github/workflows/release.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ff8a52e..2e75409 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,6 +15,9 @@ on: default: 'main' required: true +permissions: + contents: write + jobs: re-tag: runs-on: ubuntu-latest @@ -30,14 +33,10 @@ jobs: - name: Update tag with parameter if: github.event.inputs.tag != '' run: | - git tag --delete ${{ inputs.tag }} || true - git push --delete origin ${{ inputs.tag }} || true - git tag -a ${{ inputs.tag }} -m 'Retag ${{ inputs.tag }}' - git push origin ${{ inputs.tag }} - - name: Update tag to v2 + git tag -fa ${{ inputs.tag }} -m 'Retag ${{ inputs.tag }}' + git push origin ${{ inputs.tag }} --force + - name: Update rolling tag if: github.event.inputs.tag == '' run: | - git tag --delete v2 || true - git push --delete origin v2 || true - git tag -a v2 -m 'Retag v2' - git push origin v2 + git tag -fa v2 -m 'Retag v2' + git push origin v2 --force From c84b4d4192b466e51f0aaf0c1be58d37158bf2a2 Mon Sep 17 00:00:00 2001 From: Xianpeng Shen Date: Thu, 28 Aug 2025 08:48:35 +0000 Subject: [PATCH 2/2] fix: address code review comment --- .github/workflows/release.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2e75409..f490ff9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,13 +30,9 @@ jobs: run: | git config user.name 'github-actions' git config user.email '41898282+github-actions[bot]@users.noreply.github.com' - - name: Update tag with parameter - if: github.event.inputs.tag != '' - run: | - git tag -fa ${{ inputs.tag }} -m 'Retag ${{ inputs.tag }}' - git push origin ${{ inputs.tag }} --force - name: Update rolling tag - if: github.event.inputs.tag == '' run: | - git tag -fa v2 -m 'Retag v2' - git push origin v2 --force + # Get the major version from the latest tag + MAJOR_VERSION=`git tag --list --sort=-v:refname | head -n1 | cut -d. -f1` + git tag --force --annotate ${{ inputs.tag || '$MAJOR_VERSION' }} --message 'Retag ${{ inputs.tag || '$MAJOR_VERSION' }}' + git push origin ${{ inputs.tag || '$MAJOR_VERSION' }} --force