mathieudutour / github-tag-action

A Github Action to automatically bump and tag master, on merge, with the latest SemVer formatted version. Works on any platform.
https://github.com/marketplace/actions/github-tag
MIT License
641 stars 201 forks source link

feat: add prefix match tag input option #129

Open gmocquet opened 2 years ago

gmocquet commented 2 years ago

I have a special case: we are moving our legacy app to totally new architecture.

The legacy app is tagged WITHOUT the v prefix, based ONLY on the SemVer notation. For example, latest tag is: 0.0.91 The new app is tagged WITH the v prefix. For example, latest tag is: v1.0.0

I have upgrade my GitHub Action CI/CD to continue to support the both notation, relay on this, I can easily identify old and new tags/packages. In the futur, it will be easy to remove all old stuff without to check if current tag is old or new app.

Both stacks could have new version.


Context: currents tags on my git hub repo:

image

Actual behavior

If I push something related to my old stack, I'm attending that the new tag will be 0.0.92. With the version 6.0, it was not the case, the latest tag used was v1.0.0 (related to the new stack), so, new tag will be 1.0.1 image

Attended & new behavior

I use the new option prefix_match_tag I introduce to informe the github-tag-action I want that all tags must MATCH with tag_prefix to be valide. Below, usage example:

- name: Bump version and push tag
  uses: gmocquet/github-tag-action@v6.1.0
  with:
      github_token: ${{ secrets.BOT_PAT }}
      tag_prefix: ""
      release_branches: "main-v1"
      create_annotated_tag: true
      dry_run: true
      prefix_match_tag: true

Now, when I push something related to old stack, all tags prefixed by v are exclude, so, I have the attended behavior: new version is 0.0.92 image