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

Modify release script to distinguish git tag errors #1745

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
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
8 changes: 6 additions & 2 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,18 @@ if ! grep '^globus\-compute\-sdk \& globus\-compute\-endpoint v'"$VERSION"'$' do
fi

echo "releasing v$VERSION"
if git tag -s -m "v$VERSION" "$VERSION" ; then
TAG_STDERR="$(git tag -s -m \"v$VERSION\" \"$VERSION\" 2>&1 > /dev/null)"
if [[ $? == 0 ]]; then
Comment on lines +35 to +36
Copy link
Contributor

Choose a reason for hiding this comment

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

FWIW, inside of the subshell, there's not a need to escape the quotes. Consider:

TAG_STDERR="$(git tag -s -m "v$VERSION" "$VERSION" 2>&1 > /dev/null)"

Please double check me, but I think the escapes might even include the quotes in what's given to Git:

$ show_args a \"b\" c
ARG 0: show_args
ARG 1: a
ARG 2: "b"
ARG 3: c

$ SOME_VAR="$(show_args a \"b\" c)"

$ echo -e "$SOME_VAR"
ARG 0: show_args
ARG 1: a
ARG 2: "b"
ARG 3: c

echo "Git tagged $VERSION"
git push origin "$VERSION"
else
elif [[ "$TAG_STDERR" =~ "already exists" ]]; then
read -p "Tag $VERSION already exists. Release packages with this tag anyway? [y/n] " -n 1 -r
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
[[ $0 = $BASH_SOURCE ]] && exit 1 || return 1 # handle exits from shell or function but don't exit interactive shell
fi
else
echo Git tag failed: "$TAG_STDERR"
[[ $0 = $BASH_SOURCE ]] && exit 1
Comment on lines +45 to +46
Copy link
Contributor

Choose a reason for hiding this comment

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

Mildly odd to make that 4 arguments to echo instead of 1, but "meh."

fi

pushd compute_sdk
Expand Down
Loading