Skip to content

Commit

Permalink
ci: fix previous tag determination on nightly builds
Browse files Browse the repository at this point in the history
  • Loading branch information
lincolnthalles committed Sep 3, 2024
1 parent 0420405 commit fcc947a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,15 @@ setup-env NIGHTLY='':
version_from_file=v$(grep --color=never -Po 'var Version = "\K[^"]+' < ./memos/server/version/version.go)
version_from_git_tag=$(git describe --tags --abbrev=0)
version_from_ref="{{replace(env_var_or_default('GITHUB_REF_NAME', 'NOT_SET'), 'release/', '')}}"
git_previous_tag=""
if [[ "{{NIGHTLY}}" == "--nightly" ]]; then
echo -e "\n: Setting up ${BLUE}Nightly${RESET} build environment…"
git_previous_tag=$(git describe --tags --abbrev=0 --match=*-pre)
git_previous_tag=$(git describe --tags --abbrev=0 --match=*-pre || echo "")
else
echo -e "\n: Setting up ${GREEN}Release${RESET} build environment…"
git_previous_tag=$(git describe --tags --abbrev=0 --exclude=*-pre)
fi
if [[ -n "$git_previous_tag" ]]; then
git_previous_tag=$(git describe --tags --abbrev=0 --exclude=*-pre || echo "")
fi
version="v$(date +%Y.%m.%d).0"
for v in $version_from_file $version_from_git_tag $version_from_ref; do
Expand Down Expand Up @@ -160,7 +163,7 @@ setup-env NIGHTLY='':
patch=$((patch - 1))
previous_version="v${major}.${minor}.${patch}"
just add-to-env "GORELEASER_PREVIOUS_TAG" $previous_version
else
elif [[ -n "$git_previous_tag" ]]; then
just add-to-env "GORELEASER_PREVIOUS_TAG" $git_previous_tag
fi
fi
Expand Down

0 comments on commit fcc947a

Please sign in to comment.