metadata-action icon indicating copy to clipboard operation
metadata-action copied to clipboard

semver based on branch names

Open devinrsmith opened this issue 4 years ago • 2 comments

I'd like to kick off semver tags based on git branch names, as opposed to git tag names.

For example:

push refs/heads/release/v1.2.3 1.2.3, 1.2

It doesn't seem like this is possible with type=semver since that only works on git tags. type=pattern likewise doesn't apply. type=ref,event=branch, while applying to branches, doesn't allow custom patterns.

Any help would be much appreciated!

devinrsmith avatar May 28 '21 19:05 devinrsmith

I've got a hacky workaround that looks something like this:

      - name: Get Semver
        id: semver
        if: ${{ startsWith(github.ref, 'refs/heads/release/v') }}
        run: |
          semver=$(echo ${{ github.ref }} | tail -c +21)
          echo "::set-output name=semver::$semver"
          
...
          
            type=raw,enable=${{ startsWith(github.ref, 'refs/heads/release/v') }},value=${{ steps.semver.outputs.semver }}

devinrsmith avatar May 28 '21 19:05 devinrsmith

@devinrsmith That could be done through type=match def but it's only supported for tags atm. Maybe also with #56.

crazy-max avatar Jun 10 '21 21:06 crazy-max