Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Actions Stickiness Major Tagging #288

Open
paddyroddy opened this issue Nov 4, 2023 · 2 comments
Open

GitHub Actions Stickiness Major Tagging #288

paddyroddy opened this issue Nov 4, 2023 · 2 comments

Comments

@paddyroddy
Copy link

Related to #280 (but think a more simple request).

I would like to bump my repo in the standard minor fashion, however I'd also like to update the major version (/create if it doesn't exist). This is the pattern used by various GitHub Actions (like actions/checkout).

So when I go from v0.0.0v0.0.1, v0 would now link v0.0.1. Then later one v0.0.2 gets made, and v0 now points to v0.0.2. At some point v1.0.0 gets made, v1 gets created and now points to v1.0.0 etc. Thanks!

@sbe-arg
Copy link
Collaborator

sbe-arg commented Nov 9, 2023

Its definitely a feature request. In the meantime you can do it like this.

https://github.com/bridgecrewio/checkov-action/blob/master/.github/workflows/build.yml#L34

@paddyroddy
Copy link
Author

paddyroddy commented Nov 9, 2023

Thanks! I got it working with this

      - name: Bump version and push tag
        id: bump-version
        uses: anothrNick/github-tag-action@a2c70ae13a881faf2b4953baaa9e49731997ab36 # 1.67.0
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          WITH_V: true

      - name: Extract major tag
        id: extract-major
        run: >-
          echo major_tag=$(echo ${{ steps.bump-version.outputs.new_tag }} |
          cut -d'.' -f1) >> $GITHUB_OUTPUT

      # this is done manually as need a non-annotated tag
      # TODO: replace with https://github.com/actions/publish-action
      - name: Update major tag
        run: |-
          git config user.name github-actions
          git config user.email github-actions@github.com
          git tag --force ${{ steps.extract-major.outputs.major_tag }} \
          ${{ steps.bump-version.outputs.new_tag }}
          git push origin ${{ steps.extract-major.outputs.major_tag }} --force

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants