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

Fails to increment new major version pre-release #328

Open
jmax01 opened this issue Oct 14, 2024 · 1 comment
Open

Fails to increment new major version pre-release #328

jmax01 opened this issue Oct 14, 2024 · 1 comment

Comments

@jmax01
Copy link

jmax01 commented Oct 14, 2024

Fails to increment new major version pre-release (2.0.0-alpha.11 to 2.0.0-alpha.12) instead creates new patch pre-release (1.0.28-alpha.0) from latest release version (1.0.27)

I used the action to create the new major version pre-release (2.0.0-alpha.0) and that worked fine but on the next commit it created 1.0.28-alpha.0 instead of 2.0.0-alpha.1.

Note that tags 2.0.0-alpha.1 to 2.0.0-alpha.11 listed in the output were created by hand when trying to debug the behavior.

I think the issue is here:

if [[ "$pre_tag" =~ $new ]] && [[ "$pre_tag" =~ $suffix ]]

The log shows [[ 2.0.0-alpha.11 =~ 1.0.28 ]] which means that even though it can find the correct tag to increment it never will.

Should that code be if [[ ! "$pre_tag" =~ $new ]] && [[ "$pre_tag" =~ $suffix ]]?

 ##[group]Run anothrNick/github-tag-action@1.71.0
 env:
   GITHUB_TOKEN: ***
   DEFAULT_BUMP: patch
   RELEASE_BRANCHES: 
   PRERELEASE: true
   PRERELEASE_SUFFIX: alpha
   INITIAL_VERSION: 1.0.0-alpha.0
   VERBOSE: true
   DRY_RUN: true
 ##[endgroup]
 ##[command]/usr/bin/docker run --name e9551889ed6a54631b927d0ba30355f3b_76a9f3 --label 61088e --workdir /github/workspace --rm -e "GITHUB_TOKEN" -e "DEFAULT_BUMP" -e "RELEASE_BRANCHES" -e "PRERELEASE" -e "PRERELEASE_SUFFIX" -e "INITIAL_VERSION" -e "VERBOSE" -e "DRY_RUN" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e "ACTIONS_RESULTS_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/docker-ubi/docker-ubi":"/github/workspace" 61088e:9551889ed6a54631b927d0ba30355f3b
 *** CONFIGURATION ***
 	DEFAULT_BUMP: patch
 	DEFAULT_BRANCH: 
 	WITH_V: false
 	RELEASE_BRANCHES: master,main
 	CUSTOM_TAG: 
 	SOURCE: .
 	DRY_RUN: true
 	GIT_API_TAGGING: true
 	INITIAL_VERSION: 1.0.0-alpha.0
 	TAG_CONTEXT: repo
 	PRERELEASE: true
 	PRERELEASE_SUFFIX: alpha
 	VERBOSE: true
 	MAJOR_STRING_TOKEN: #major
 	MINOR_STRING_TOKEN: #minor
 	PATCH_STRING_TOKEN: #patch
 	NONE_STRING_TOKEN: #none
 	BRANCH_HISTORY: compare
 	FORCE_WITHOUT_CHANGES: false
 	FORCE_WITHOUT_CHANGES_PRE: false
 	TAG_MESSAGE: 
 ++ git rev-parse --abbrev-ref HEAD
 pre_release = true
 + current_branch=HEAD
 + pre_release=true
 + IFS=,
 + read -ra branch
 + for b in "${branch[@]}"
 + [[ HEAD == \m\a\s\t\e\r ]]
 + '[' master '!=' master ']'
 + for b in "${branch[@]}"
 + [[ HEAD == \m\a\i\n ]]
 + '[' main '!=' main ']'
 + echo 'pre_release = true'
 + git fetch --tags
 + tagFmt='^v?[0-9]+\.[0-9]+\.[0-9]+$'
 + preTagFmt='^v?[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+)$'
 + git_refs=
 + case "$tag_context" in
 ++ git for-each-ref --sort=-v:refname --format '%(refname:lstrip=2)'
 + git_refs='2.0.0-alpha.11
 2.0.0-alpha.10
 2.0.0-alpha.9
 2.0.0-alpha.8
 2.0.0-alpha.7
 2.0.0-alpha.6
 2.0.0-alpha.5
 2.0.0-alpha.4
 2.0.0-alpha.3
 2.0.0-alpha.2
 2.0.0-alpha.1
 2.0.0-alpha.0
 1.0.27
 1.0.26
 1.0.25
 1.0.24
 1.0.23-alpha.0
 1.0.23
 1.0.22
 1.0.21
 1.0.20
 1.0.19
 1.0.18
 1.0.17
 1.0.16
 1.0.15
 1.0.14
 1.0.13-alpha.0
 1.0.13
 1.0.12-alpha.1
 1.0.12-alpha.0
 1.0.12
 1.0.11
 1.0.10-alpha.0
 1.0.10
 1.0.9
 1.0.8
 1.0.7-alpha.0
 1.0.7
 1.0.6-alpha.0
 1.0.6
 1.0.5-alpha.0
 1.0.5
 1.0.4-alpha.0
 1.0.4
 1.0.3-alpha.6
 1.0.3-alpha.5
 1.0.3-alpha.4
 1.0.3-alpha.3
 1.0.3-alpha.2
 1.0.3-alpha.1
 1.0.3-alpha.0
 1.0.3
 1.0.2-alpha.2
 1.0.2-alpha.1
 1.0.2-alpha.0
 1.0.2
 1.0.1-alpha.0
 1.0.1
 1.0.0-alpha.23
 1.0.0-alpha.22
 1.0.0-alpha.21
 1.0.0-alpha.20
 1.0.0-alpha.19
 1.0.0-alpha.18
 1.0.0-alpha.17
 1.0.0-alpha.16
 1.0.0-alpha.15
 1.0.0-alpha.14
 1.0.0-alpha.13
 1.0.0-alpha.12
 1.0.0-alpha.11
 1.0.0-alpha.10
 1.0.0-alpha.9
 1.0.0-alpha.8
 1.0.0-alpha.7
 1.0.0-alpha.6
 1.0.0-alpha.5
 1.0.0-alpha.4
 1.0.0-alpha.3
 1.0.0-alpha.2
 1.0.0-alpha.1
 1.0.0
 origin/main'
 ++ grep -E '^v?[0-9]+\.[0-9]+\.[0-9]+$'
 + matching_tag_refs='1.0.27
 1.0.26
 1.0.25
 1.0.24
 1.0.23
 1.0.22
 1.0.21
 1.0.20
 1.0.19
 1.0.18
 1.0.17
 1.0.16
 1.0.15
 1.0.14
 1.0.13
 1.0.12
 1.0.11
 1.0.10
 1.0.9
 1.0.8
 1.0.7
 1.0.6
 1.0.5
 1.0.4
 1.0.3
 1.0.2
 1.0.1
 1.0.0'
 ++ grep -E '^v?[0-9]+\.[0-9]+\.[0-9]+(-alpha\.[0-9]+)$'
 + matching_pre_tag_refs='2.0.0-alpha.11
 2.0.0-alpha.10
 2.0.0-alpha.9
 2.0.0-alpha.8
 2.0.0-alpha.7
 2.0.0-alpha.6
 2.0.0-alpha.5
 2.0.0-alpha.4
 2.0.0-alpha.3
 2.0.0-alpha.2
 2.0.0-alpha.1
 2.0.0-alpha.0
 1.0.23-alpha.0
 1.0.13-alpha.0
 1.0.12-alpha.1
 1.0.12-alpha.0
 1.0.10-alpha.0
 1.0.7-alpha.0
 1.0.6-alpha.0
 1.0.5-alpha.0
 1.0.4-alpha.0
 1.0.3-alpha.6
 1.0.3-alpha.5
 1.0.3-alpha.4
 1.0.3-alpha.3
 1.0.3-alpha.2
 1.0.3-alpha.1
 1.0.3-alpha.0
 1.0.2-alpha.2
 1.0.2-alpha.1
 1.0.2-alpha.0
 1.0.1-alpha.0
 1.0.0-alpha.23
 1.0.0-alpha.22
 1.0.0-alpha.21
 1.0.0-alpha.20
 1.0.0-alpha.19
 1.0.0-alpha.18
 1.0.0-alpha.17
 1.0.0-alpha.16
 1.0.0-alpha.15
 1.0.0-alpha.14
 1.0.0-alpha.13
 1.0.0-alpha.12
 1.0.0-alpha.11
 1.0.0-alpha.10
 1.0.0-alpha.9
 1.0.0-alpha.8
 1.0.0-alpha.7
 1.0.0-alpha.6
 1.0.0-alpha.5
 1.0.0-alpha.4
 1.0.0-alpha.3
 1.0.0-alpha.2
 1.0.0-alpha.1'
 ++ head -n 1
 + tag=1.0.27
 ++ head -n 1
 + pre_tag=2.0.0-alpha.11
 + '[' -z 1.0.27 ']'
 ++ git rev-list -n 1 1.0.27
 + tag_commit=8e8687be5ad7286fa2d2046f8c235c99463a3f5a
 ++ git rev-parse HEAD
 + commit=092366c1dd8136dfb9a0cfcd5b9d8b878838e705
 + '[' 8e8687be5ad7286fa2d2046f8c235c99463a3f5a == 092366c1dd8136dfb9a0cfcd5b9d8b878838e705 ']'
 + '[' -z '' ']'
 + '[' compare == full ']'
 ++ git show -s --format=%B
 ++ git log ..HEAD --format=%B
 ++ git log 8e8687be5ad7286fa2d2046f8c235c99463a3f5a..092366c1dd8136dfb9a0cfcd5b9d8b878838e705 --format=%B
 + history_type=(['last']='Update README.md' ['full']='' ['compare']='Update README.md
 FWA-3172 version issue
 FWA-3172 version issue
 FWA-3172 version issue
 FWA-3172 version issue
 FWA-3172 version issue
 Update README.md
 FWA-3172 version issue
 Update README.md
 FWA-3172 fix missing build-context
 FWA-3172 fix missing build-context (#157)
 
 
 FWA-3172 remove pip and add scripts (#156)
 
 
 Fix new major/new minor version
 
 [skip ci]')
 + declare -A history_type
 + log='Update README.md
 FWA-3172 version issue
 FWA-3172 version issue
 FWA-3172 version issue
 FWA-3172 version issue
 FWA-3172 version issue
 Update README.md
 FWA-3172 version issue
 Update README.md
 FWA-3172 fix missing build-context
 FWA-3172 fix missing build-context (#157)
 
 
 FWA-3172 remove pip and add scripts (#156)
 
 
 Fix new major/new minor version
 
 [skip ci]'
 + printf 'History:\n---\n%s\n---\n' 'Update README.md
 FWA-3172 version issue
 FWA-3172 version issue
 FWA-3172 version issue
 FWA-3172 version issue
 FWA-3172 version issue
 Update README.md
 FWA-3172 version issue
 Update README.md
 FWA-3172 fix missing build-context
 FWA-3172 fix missing build-context (#157)
 
 
 FWA-3172 remove pip and add scripts (#156)
 
 
 Fix new major/new minor version
 
 [skip ci]'
 + case "$log" in
 + '[' patch == none ']'
 ++ semver -i patch 1.0.27
 History:
 ---
 Update README.md
 FWA-3172 version issue
 FWA-3172 version issue
 FWA-3172 version issue
 FWA-3172 version issue
 FWA-3172 version issue
 Update README.md
 FWA-3172 version issue
 Update README.md
 FWA-3172 fix missing build-context
 FWA-3172 fix missing build-context (#157)
 
 
 FWA-3172 remove pip and add scripts (#156)
 
 
 Fix new major/new minor version
 
 [skip ci]
 ---
 + new=1.0.28
 + part=patch
 + true
 ++ git rev-list -n 1 2.0.0-alpha.11
 + pre_tag_commit=46c7bae69d4e38d93aa0fffc5e4969a58a0b4562
 + '[' 46c7bae69d4e38d93aa0fffc5e4969a58a0b4562 == 092366c1dd8136dfb9a0cfcd5b9d8b878838e705 ']'
 + [[ 2.0.0-alpha.11 =~ 1.0.28 ]]
 + false
 + new=1.0.28-alpha.0
 + echo -e 'Setting alpha pre-tag 2.0.0-alpha.11 - With pre-tag 1.0.28-alpha.0'
 + part=pre-patch
 + '[' -n '' ']'
 + setOutput new_tag 1.0.28-alpha.0
 + echo new_tag=1.0.28-alpha.0
 + setOutput part pre-patch
 Setting alpha pre-tag 2.0.0-alpha.11 - With pre-tag 1.0.28-alpha.0
 + echo part=pre-patch
 + setOutput tag 1.0.28-alpha.0
 + echo tag=1.0.28-alpha.0
 + setOutput old_tag 1.0.27
 + echo old_tag=1.0.27
 + true
 + exit 0
@jmax01
Copy link
Author

jmax01 commented Oct 14, 2024

I made the change on a fork and it worked as expected in my case https://github.com/jmax01/github-tag-action/blob/d281a199c5a117f1c2608dc00dee8ba885646e88/entrypoint.sh#L205

Note I am just expecting every commit to increment the latest prerelease segment and I never use the comment functionality to change versions.

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

1 participant