[PRM-691] Updated static tag to main (#227) #12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Z-AUTOMATED: Push to main" | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| id-token: write | |
| contents: write | |
| jobs: | |
| update-floating-tag: | |
| name: Update floating tag to point to latest commit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check if floating tag exists | |
| id: check-floating-tag | |
| run: | | |
| git config user.name "github-actions" | |
| git config user.email "github-actions@github.com" | |
| LATEST_FLOATING_VERSION=$(git tag --list 'v*' --sort=-v:refname | head -n1) | |
| floating_tag="v${LATEST_FLOATING_VERSION#v}" # strip the leading "v" if present | |
| echo "Found tag ${floating_tag} re-creating it to point to latest commit" | |
| git tag -d $floating_tag | |
| echo "${floating_tag} deleted locally." | |
| git push --delete origin $floating_tag | |
| echo "${floating_tag} deleted from origin." | |
| git tag -a $floating_tag -m "Floating tag for ${floating_tag}" | |
| echo "${floating_tag} re-created pointing to ${{ github.sha }}." | |
| git push origin $floating_tag | |
| echo "${floating_tag} pushed to origin." |