Skip to content

Commit a6b54e4

Browse files
committed
use generic _findEnvironmentVariable
1 parent 063a99f commit a6b54e4

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

release.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ use() {
1818
done
1919
}
2020

21+
_findEnvironmentVariable() {
22+
local variableName=$1
23+
test -n "${!variableName}" && return
24+
read -p "$variableName: " "$variableName"
25+
test -z "${!variableName}" && _error "$variableName not found"
26+
}
27+
2128
use jq git curl grep tr sed xargs md5sum
2229

2330
_releaseMessage() {
@@ -63,12 +70,6 @@ _fileHashes() {
6370
done
6471
}
6572

66-
_findGithubToken() {
67-
test -n "$GITHUB_TOKEN" && return
68-
read -p "GITHUB_TOKEN: " GITHUB_TOKEN
69-
test -z "$GITHUB_TOKEN" && _error "GITHUB_TOKEN not found"
70-
}
71-
7273
_findGitHeads() {
7374
local last_tag=$(git tag --sort=-creatordate | head -1)
7475
GIT_TAG=${2:-HEAD}
@@ -82,7 +83,7 @@ _findGitHeads() {
8283

8384
main () {
8485
_findGitHeads $@
85-
_findGithubToken
86+
_findEnvironmentVariable GITHUB_TOKEN
8687
_releaseMessage
8788
}
8889

0 commit comments

Comments
 (0)