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

fix: check if tag exists on remote before... #1230

Merged
merged 2 commits into from
Dec 6, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions make-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,12 @@ pushGitChanges() {
echo "[INFO] Push git changes into $RELEASE_BRANCH branch"
git push origin $RELEASE_BRANCH ${FORCE_UPDATE}
if [[ $FORCE_UPDATE == "--force" ]]; then # if forced update, delete existing tag so we can replace it
if git rev-parse "$RELEASE" >/dev/null 2>&1; then # if tag exists
git tag -d $RELEASE
if [[ $(git ls-remote --tags $(git remote get-url origin) $RELEASE) ]]; then # if tag exists in remote repo
echo "Remove existing tag $RELEASE"
git tag -d $RELEASE || true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of || true, maybe use a separate if block with $(git tag -l | grep $RELEASE)?

git push origin :$RELEASE
else
echo "Remote tag $RELEASE does not exist" # should never get here
fi
fi
git tag -a $RELEASE -m $RELEASE
Expand Down