Skip to content

Commit 82452d5

Browse files
committed
Updated the release scripts
Added some fail safe operations to the release script, so they won't do a partial release when missing required information or commands.
1 parent 29b1ad8 commit 82452d5

File tree

2 files changed

+58
-7
lines changed

2 files changed

+58
-7
lines changed

Diff for: scripts/beta-release

+28-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,36 @@
11
#!/usr/bin/env bash
22
# Automatically update versions in files and create an autorelease.
3-
# Requires the github CLI.
3+
# Requires the github CLI, and the jq command
4+
5+
EXIT=""
46
NEW_VERSION=$1
57

8+
if [ -z "$EDITOR" ]; then
9+
echo "Specify which editor to use in EDITOR, or by doing: EDITOR=vi ./scripts/beta-release 0.x.y"
10+
EXIT=1
11+
fi
12+
13+
if ! command -v jq 2>&1 >/dev/null; then
14+
echo "This script relies on the 'jq' command, please install it"
15+
EXIT=1
16+
fi
17+
18+
if ! command -v gh 2>&1 >/dev/null; then
19+
echo "This script relies on the 'gh' command from the Github CLI package, please install it"
20+
EXIT=1
21+
fi
22+
23+
if [ $EXIT ]; then
24+
exit $EXIT
25+
fi
26+
27+
if [ -z "$NEW_VERSION" ]; then
28+
NEW_VERSION=$(jq -r ".version" manifest-beta.json | awk -F. -v OFS=. '{$NF += 1 ; print}')
29+
fi
30+
631
if [ -z "$NEW_VERSION" ]; then
7-
NEW_VERSION=$(jq -r ".version" manifest-beta.json | awk -F. -v OFS=. '{$NF += 1 ; print}')
32+
echo "Auto-generating next version number failed, please specify next version : ./scripts/beta-release 0.x.y"
33+
exit 1
834
fi
935

1036
echo "Releasing beta version '${NEW_VERSION}'"

Diff for: scripts/release

+30-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,35 @@
11
#!/usr/bin/env bash
22
# Automatically update versions in files and create an autorelease.
33
# Requires the github CLI and jq (if you don't update the version manually).
4+
EXIT=""
45
NEW_VERSION=$1
56

7+
if [ -z "$EDITOR" ]; then
8+
echo "Specify which editor to use in EDITOR, or by doing: EDITOR=vi ./scripts/release 0.x.y"
9+
EXIT=1
10+
fi
11+
12+
if ! command -v jq 2>&1 >/dev/null; then
13+
echo "This script relies on the 'jq' command, please install it"
14+
EXIT=1
15+
fi
16+
17+
if ! command -v gh 2>&1 >/dev/null; then
18+
echo "This script relies on the 'gh' command from the Github CLI package, please install it"
19+
EXIT=1
20+
fi
21+
22+
if [ $EXIT ]; then
23+
exit $EXIT
24+
fi
25+
26+
if [ -z "$NEW_VERSION" ]; then
27+
NEW_VERSION=$(jq -r ".version" manifest-beta.json | awk -F. -v OFS=. '{$NF += 1 ; print}')
28+
fi
29+
630
if [ -z "$NEW_VERSION" ]; then
7-
NEW_VERSION=$(jq -r ".version" manifest-beta.json | awk -F. -v OFS=. '{$NF += 1 ; print}')
31+
echo "Auto-generating next version number failed, please specify next version : ./scripts/release 0.x.y"
32+
exit 1
833
fi
934

1035
# Let users edit release-notes.txt for release notes.
@@ -30,10 +55,10 @@ rm -f manifest-beta.tmp.json
3055
rm -f versions.tmp.json
3156

3257
# Rewrite versions in relevant files.
33-
# no jq# jq ".version=\"${NEW_VERSION}\"" package.json > package.tmp.json && mv package.tmp.json package.json
34-
# no jq# jq ".version=\"${NEW_VERSION}\"" manifest.json > manifest.tmp.json && mv manifest.tmp.json manifest.json
35-
# no jq# jq ".version=\"${NEW_VERSION}\"" manifest-beta.json > manifest-beta.tmp.json && mv manifest-beta.tmp.json manifest-beta.json
36-
# no jq# jq ". + {\"${NEW_VERSION}\": \"0.12.0\"}" versions.json > versions.tmp.json && mv versions.tmp.json versions.json
58+
jq ".version=\"${NEW_VERSION}\"" package.json > package.tmp.json && mv package.tmp.json package.json
59+
jq ".version=\"${NEW_VERSION}\"" manifest.json > manifest.tmp.json && mv manifest.tmp.json manifest.json
60+
jq ".version=\"${NEW_VERSION}\"" manifest-beta.json > manifest-beta.tmp.json && mv manifest-beta.tmp.json manifest-beta.json
61+
jq ". + {\"${NEW_VERSION}\": \"0.12.0\"}" versions.json > versions.tmp.json && mv versions.tmp.json versions.json
3762

3863
# Overwrite the beta manifest as well.
3964
cp manifest.json manifest-beta.json

0 commit comments

Comments
 (0)