diff --git a/.github/workflows/release_tag.yml b/.github/workflows/release_tag.yml index 6dce8f0..b4b7bc4 100644 --- a/.github/workflows/release_tag.yml +++ b/.github/workflows/release_tag.yml @@ -1,40 +1,36 @@ # This GitHub Actions workflow updates the "stable" and "latest" Git tags -# to point to the tag associated with a newly published release. It performs -# the following steps: -# 1. Checks out the repository code with full history. -# 2. Configures Git with a generic user for the action. +# to point to the latest commit on the main branch whenever code is merged. +# It performs the following steps: +# 1. Checks out the repository code with full history +# 2. Configures Git with a generic user for the action # 3. Moves and forcibly pushes the "stable" and "latest" tags to align with -# the tag of the newly published release. -# This ensures that "stable" and "latest" always point to the most recent release. +# the latest main branch commit --- name: Update Tags -# yamllint disable-line rule:truthy -on: - release: - types: [published] +on: # yamllint disable-line rule:truthy + push: + branches: + - main jobs: update-tags: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@main + uses: actions/checkout@v4 with: - fetch-depth: '0' + fetch-depth: 0 - name: Set up Git run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" - - name: Move and push stable tag + - name: Move and push tags run: | - git tag -f stable ${{ github.event.release.tag_name }} - git push -f origin stable - - - name: Move and push latest tag - run: | - git tag -f latest ${{ github.event.release.tag_name }} - git push -f origin latest + echo "Creating/updating stable and latest tags pointing to latest main commit" + git tag -fa stable -m "Update stable tag to latest main" + git tag -fa latest -m "Update latest tag to latest main" + git push origin stable latest --force ...