github-tag-action
github-tag-action copied to clipboard
If there is no tag on a repo, the script won't generate any tags or Changelog.
After a lot of trying and error, I found an issue (maybe it's not a bug but a feature) when pushing code to a repository without tags. The parser will say there are no new commits, so it won't generate any new versions.
I've gotten 0.0.1
on repos with no tags using v5 of this action
I've encountered this as well, i started creating v0.0.0 releases every time i create a new repo
I've encountered this as well, i started creating v0.0.0 releases every time i create a new repo
That's exactly what I ended up doing...
Hey @mathieudutour would you mind if I take this and make a PR for it during this week?
yeah I'd be more than happy to review a PR :)
I started working on this and I could isolate the case where this is happenning: default_bump set to 'false', it should probably create tag v0.0.0 or the correspoding semver tag for the commits.
So, here's my question for you @mathieudutour, should the script automatically create the tag 0.0.0 or a tag based on the commits the user just pushed?
Not sure I understand exactly but I'd say the script should assume the previous tag was 0.0.0
if there wasn't any before, and generate the real one based on the commits (and bump relatively to 0.0.0
).
Yup, you understood perfectly :) Ok! Will work on that
So, this action already assumed the prior tag to be 0.0.0
when there is no tag in the repo.
I have a no-code fix for this that I've implemented on some private repos:
I'd like the initial release for the repo to be v1.0.0
so I've set this up to calculate the default_bump
in a prior step based on if there's a tag or not. The actions-ecosystem/action-get-latest-tag
action defaults to v0.0.0
when there is no tag, so based on this I'm setting the default_bump
to be major
. If you want it to be 0.1.0, just set it to minor
.
If you choose to set default_bump
to false, then clearly this won't work.
steps:
- uses: 'actions/[email protected]'
with:
fetch-depth: 0
- name: 'Action Get Latest Tag'
uses: 'actions-ecosystem/[email protected]'
id: 'get-latest-tag'
with:
semver_only: true
- name: 'Determine default bump'
id: 'bump'
run: |
LATEST_TAG=${{ steps.get-latest-tag.outputs.tag }}
if [ "$LATEST_TAG" = "v0.0.0" ]; then
echo "::set-output name=type::major"
else
echo "::set-output name=type::patch"
fi
- name: 'Bump version and push tag'
id: 'tag_version'
uses: 'mathieudutour/[email protected]'
with:
github_token: '${{ secrets.REPO_ONLY }}'
release_branches: 'main'
default_bump: '${{ steps.bump.outputs.type }}'
Is there an updated for this issue?