Update release.sh to bail on errors and detect git remote name #98
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Using the shell options
-e
,-u
, and-o pipefail
is generally good hygiene to catch errors. I ran into this when bumping Ruby versions for the first time because I rename the "origin" remote to "github" in my local checkouts. That caused the script to fail when settingdefaultBranch
and it attempted to plow ahead anyway which is not desirable since the rest of the script makes commits and pushes them.The other change is to detect the name of the git remote linked to the current branch when running
release.sh
, which is probably "main" most of the time. This will fail when the current branch isn't tracking an upstream branch yet so if that's a common case the current code here won't work. I understand if you'd rather not bother with that change and I'll revert it or find an alternative method that doesn't rely on having the current branch tracking an upstream one if you're open to that.