Question: Version tag with prefix
Closed this issue · 7 comments
Hi there!
How I can add prefix to tag version?
I have v0.1.0
tag in my repository and try configure action step like this:
jobs:
bump:
runs-on: ubuntu-latest
steps:
- id: bump
uses: zwaldowski/match-label-action@v2
with:
allowed: major,minor,patch
- uses: zwaldowski/semver-release-action@v1
with:
bump: ${{ steps.bump.outputs.match }}
github_token: ${{ secrets.GITHUB_TOKEN }}
prefix: "v"
and set label minor
for pull request.
But it still 0.2.0
instead of v0.2.0
.
Can you help me with that?
Prefix is used here. Do you have a log from the action running? It should always output to the log the version it's using. You can use dry_run
to avoid actually writing to Git.
I have a log from one of the action runnings with configuration as I wrote above:
Download action repository 'zwaldowski/match-label-action@v2'
Download action repository 'zwaldowski/semver-release-action@v1'
##[group]Run zwaldowski/match-label-action@v2
with:
allowed: major,minor,patch
##[endgroup]
##[group]Run zwaldowski/semver-release-action@v1
with:
bump: minor
github_token: ***
prefix: v
dry_run: false
##[endgroup]
And the result of this action is the 0.2.0
tag instead of the v0.2.0
.
Aha! Sorry about that. #5 isn't in v1. I've just tagged v2. You can use @master
or @v2
. Please let me know if you still have trouble.
Thanks a lot!
I'll try it now. )
Yes, now it works! )
Thanks for answer!
But I have one more problem: if I set a trigger for actions like this:
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
types:
- closed
The merge is tagged correctly, but there is a failure:
##[group]Run zwaldowski/match-label-action@v2
with:
allowed: major,minor,patch
##[endgroup]
##[error]Could not find exactly one of the appropriate labels on the PR.
How to tag merge commit correctly?
Sorry if the question is not for this repository.
Glad to hear we figured it out.
So if you want to be able to push straight to master, you'll need some other way to get a version bump type… GitHub doesn't associate PR information with a plain push to master.
My teams handle this by applying Branch Protection to master and making PRs for releases — i.e., we only have the pull_request
trigger in your sample. So that's where match-label-action
action comes in; that's actually why this action and match-label-action
are separate, so you can do whatever fits your workflow better.
Let me know with another issue if you have any thoughts on how better to handle that.
Ah, now I see it.
I removed the push to master
trigger from my action configuration, and tagging still works correctly for merge commits. This was not entirely obvious to me for the first time when using the closed
type for the pull_request
trigger.
I support your release approach through PRs and use it in my work too.
Thanks again!
Wish you to have a nice day and good health. )