push-release.sh: improve --dry-run mode
- Don't require OAUTH_TOKEN - Skip interactive query
This commit is contained in:
parent
82a2b148d8
commit
8a757e0486
@ -3,14 +3,10 @@ set -euo pipefail
|
|||||||
|
|
||||||
REPO=fort-nix/nix-bitcoin
|
REPO=fort-nix/nix-bitcoin
|
||||||
BRANCH=master
|
BRANCH=master
|
||||||
OAUTH_TOKEN=$(pass show nix-bitcoin/github/oauth-token)
|
OAUTH_TOKEN=
|
||||||
DRY_RUN=
|
DRY_RUN=
|
||||||
TAG_NAME=
|
TAG_NAME=
|
||||||
|
|
||||||
if [[ ! $OAUTH_TOKEN ]]; then
|
|
||||||
echo "Please set OAUTH_TOKEN variable"
|
|
||||||
fi
|
|
||||||
|
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
case $arg in
|
case $arg in
|
||||||
--dry-run|-n)
|
--dry-run|-n)
|
||||||
@ -26,18 +22,28 @@ if [[ ! $TAG_NAME ]]; then
|
|||||||
echo "$0 [--dry-run|-n] <tag_name>"
|
echo "$0 [--dry-run|-n] <tag_name>"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
if [[ $DRY_RUN ]]; then echo "Dry run"; fi
|
if [[ $DRY_RUN ]]; then
|
||||||
|
echo "Dry run"
|
||||||
|
else
|
||||||
|
OAUTH_TOKEN=$(pass show nix-bitcoin/github/oauth-token)
|
||||||
|
if [[ ! $OAUTH_TOKEN ]]; then
|
||||||
|
echo "Please set OAUTH_TOKEN variable"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
RESPONSE=$(curl https://api.github.com/repos/$REPO/releases/latest 2> /dev/null)
|
RESPONSE=$(curl https://api.github.com/repos/$REPO/releases/latest 2> /dev/null)
|
||||||
echo "Latest release" $(echo $RESPONSE | jq -r '.tag_name' | tail -c +2)
|
echo "Latest release" $(echo $RESPONSE | jq -r '.tag_name' | tail -c +2)
|
||||||
while true; do
|
|
||||||
read -p "Create release $TAG_NAME? [yn] " yn
|
if [[ ! $DRY_RUN ]]; then
|
||||||
case $yn in
|
while true; do
|
||||||
[Yy]* ) break;;
|
read -p "Create release $TAG_NAME? [yn] " yn
|
||||||
[Nn]* ) exit;;
|
case $yn in
|
||||||
* ) echo "Please answer y or n.";;
|
[Yy]* ) break;;
|
||||||
esac
|
[Nn]* ) exit;;
|
||||||
done
|
* ) echo "Please answer y or n.";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
TMPDIR=$(mktemp -d)
|
TMPDIR=$(mktemp -d)
|
||||||
if [[ ! $DRY_RUN ]]; then trap "rm -rf $TMPDIR" EXIT; fi
|
if [[ ! $DRY_RUN ]]; then trap "rm -rf $TMPDIR" EXIT; fi
|
||||||
|
Loading…
Reference in New Issue
Block a user