diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ff8a52e9..f490ff93 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 @@ -27,17 +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 --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 - if: github.event.inputs.tag == '' + - name: Update rolling tag run: | - git tag --delete v2 || true - git push --delete origin v2 || true - git tag -a v2 -m 'Retag v2' - git push origin v2 + # 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