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

Question about grep parameters on commit 72f3a5453 #265

Closed
madmac2501 opened this issue May 14, 2023 · 6 comments
Closed

Question about grep parameters on commit 72f3a5453 #265

madmac2501 opened this issue May 14, 2023 · 6 comments

Comments

@madmac2501
Copy link

Hi,

I'm trying to publish a prerelease and it's failing for me. I've reviewing the code and the grep parameters to calculate the pre_tag have changed to include -qs . In linux the -q parameter prevents any output so the pre_tagvariable is always empty. Could you confirm that these grep parameters are correct?

https://github.com/anothrNick/github-tag-action/blob/master/entrypoint.sh#L85
https://github.com/anothrNick/github-tag-action/blob/master/entrypoint.sh#L89

Thanks a lot!

@sbe-arg
Copy link
Collaborator

sbe-arg commented May 15, 2023

A couple of things.

Yes. -qs is unnecesary as we have || true... the idea was -s but returns non 0 when null results

I'm mind blown the tags do work regardless. https://github.com/anothrNick/github-tag-action/actions/runs/4944067451#summary-13392394770 and here https://github.com/sbe-arg/dummy-releases/releases/tag/0.6.0-dummy.0

The -qs resulting in always null will only break the semantic bumping if the last release is a prerelease and is bumping over a branch. (we do need a pr to remove the -qs flags here #267)

when you say the pre-release is failling what do you mean? the action errors or the pre-release tag is not created and fallsback to regular tag?

can you share your config of the workflow and the runner logs with verbose: true

side note found that the documentation needs to be adjusted for the checkout to not conflict with the default release_branches #266

@sbe-arg
Copy link
Collaborator

sbe-arg commented May 15, 2023

@sammcj

@madmac2501
Copy link
Author

madmac2501 commented May 15, 2023

Hi!

here are the logs with private info removed, the git command failure is not shown with verbose: true

++ git rev-parse --abbrev-ref HEAD
*** CONFIGURATION ***
	DEFAULT_BUMP: patch
	DEFAULT_BRANCH: 
	WITH_V: false
	RELEASE_BRANCHES: main
	CUSTOM_TAG: 
	SOURCE: .
	DRY_RUN: false
	INITIAL_VERSION: 0.15.0
	TAG_CONTEXT: repo
	PRERELEASE: true
	PRERELEASE_SUFFIX: rc
	VERBOSE: true
	MAJOR_STRING_TOKEN: #major
	MINOR_STRING_TOKEN: #minor
	PATCH_STRING_TOKEN: #patch
	NONE_STRING_TOKEN: #none
	BRANCH_HISTORY: compare
+ current_branch=develop
+ pre_release=true
+ IFS=,
+ read -ra branch
+ for b in "${branch[@]}"
+ [[ develop == \m\a\i\n ]]
+ '[' main '!=' main ']'
+ echo 'pre_release = true'
+ git fetch --tags
pre_release = true
+ tagFmt='^v?[0-9]+\.[0-9]+\.[0-9]+$'
+ preTagFmt='^v?[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)$'
+ case "$tag_context" in
++ head -n 1
++ grep -E '^v?[0-9]+\.[0-9]+\.[0-9]+$'
++ git for-each-ref --sort=-v:refname --format '%(refname:lstrip=2)'
++ true
+ tag=0.15.29
++ grep -qs -E '^v?[0-9]+\.[0-9]+\.[0-9]+(-rc\.[0-9]+)$'
++ head -n 1
++ git for-each-ref --sort=-v:refname --format '%(refname:lstrip=2)'
+ pre_tag=

And the command fails on the line https://github.com/anothrNick/github-tag-action/blob/master/entrypoint.sh#L181 because the pre_tag variable is empty

fatal: ambiguous argument '': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Setting rc pre-tag  - With pre-tag 0.15.30-rc.0
fatal: tag '0.15.30-rc.0' already exists

Please let me know if you need anything else

@sbe-arg
Copy link
Collaborator

sbe-arg commented May 15, 2023

Just merged #267 which is the case of bumping a release tag with another release tag.
Sorry for this issue. the -q slipped in by accident.

This is the kind of scenario is hard to test in this repo. As we can only test against having a release branch strategy and we choose to release to master.

@sbe-arg sbe-arg closed this as completed May 15, 2023
@madmac2501
Copy link
Author

No worries, thanks for the work of developing and maintaining the github action!

@dhakiki
Copy link

dhakiki commented Nov 4, 2023

@sbe-arg i just wanted to really thank you for working so hard on this. I was stuck on the older version that was in the docs (three patches behind) and running into this same problem.. feeling really defeated and as a last straw of hope checked out latest and found this gem. thank you so so much for your hard work on this. i think i tried three different tools and a lot of head banging to get to where i am today, im so thrilled.

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

3 participants