Skip to content

Commit

Permalink
release: don't restrict tag names
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanhb authored Feb 6, 2023
1 parent 7ad682d commit 9dfdf57
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions .github/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ set_property() {
release_prepare() {
COMMIT_ID="$(git log -1 --pretty=%H)"
if TAG="$(git describe --exact-match --tags 2>/dev/null)"; then
info "Tag $TAG found on commit $(git log -1 --pretty=%H), skip creating tag."
info "Tag $TAG found on commit $COMMIT_ID, skip creating tag."
return
fi
[ "${1-}" != "--dry-run" ] || DRY_RUN=1
Expand All @@ -80,10 +80,9 @@ release_prepare() {
check_version "$REVISION" release
fi

local TAG_PATTERN='^\(v\{0,1\}[0-9]\{1,\}\(\.[0-9]\{1,\}\)*\)$'
if [ -n "$INPUT_TAG" ]; then
expr "$INPUT_TAG" : "$TAG_PATTERN" >/dev/null || error "invalid git tag <$INPUT_TAG>"
TAG="$INPUT_TAG"
TAG="$(git check-ref-format --normalize --allow-onelevel "/$INPUT_TAG")" || error "fatal: '$INPUT_TAG' is not a valid tag name."
case "$TAG" in -*) error "fatal: '$INPUT_TAG' is not a valid tag name." ;; esac
else
TAG="$REVISION"
fi
Expand Down Expand Up @@ -120,13 +119,13 @@ release_prepare() {
./mvnw -B --color=always -N versions:set-scm-tag "-DnewTag=$TAG"
git add pom.xml
git commit -m "Release $REVISION"
git tag "$TAG"
git tag -- "$TAG"
./mvnw -B --color=always -N versions:revert
set_property revision "$NEXT_SNAPSHOT"
git add pom.xml
git commit -m "prepare for next development iteration"
[ -n "$DRY_RUN" ] || git push --atomic origin "$TAG" "$BRANCH"
git checkout "tags/$TAG"
[ -n "$DRY_RUN" ] || git push --atomic origin "refs/tags/$TAG" "refs/heads/$BRANCH"
git -c advice.detachedHead=false checkout "refs/tags/$TAG"
}

release_perform() {
Expand Down

0 comments on commit 9dfdf57

Please sign in to comment.