Skip to content

Commit

Permalink
release.sh: identify the remote before switching into DRYRUN mode (#…
Browse files Browse the repository at this point in the history
…1498)

Motivation:

Current version of the release script identifies the remote after the
`DRYRUN` mode overrides `git` command. As the result, logs do not show
which remote will be used when the `DRYRUN` mode will be off.

Modifications:

- Move lines that identify `remote` before the `DRYRUN` mode check;
- Print a message when `DRYRUN` mode is enabled;

Result:

`DRYRUN` mode correctly shows the git remote.
  • Loading branch information
idelpivnitskiy authored Apr 16, 2021
1 parent 8e762a9 commit e516c64
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,18 @@ fi
echo "Releasing version $version"
version_majorminor="${version%.*}"

remote=$(git remote -v | grep "apple/servicetalk.git" | head -n1)
remote_name=$(echo $remote | cut -d' ' -f1)
remote_url=$(echo $remote | cut -d' ' -f2)
echo "Working with remote $remote_name -> $remote_url"

if [ -z "${DRYRUN:-}" ]; then
git="git"
else
git="echo git"
echo "DRYRUN mode is enabled, any further changes won't be committed."
fi

remote=$(git remote -v | grep "apple/servicetalk.git" | head -n1)
remote_name=$(echo $remote | cut -d' ' -f1)
remote_url=$(echo $remote | cut -d' ' -f2)

echo "Working with remote $remote_name -> $remote_url"

$git fetch -p
if $git rev-parse --quiet --verify main > /dev/null; then
$git checkout main
Expand Down

0 comments on commit e516c64

Please sign in to comment.