File tree 1 file changed +14
-1
lines changed
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -10,8 +10,9 @@ source "${DIR}/include.sh"
10
10
# TRAVIS_TAG=your_release_version GITHUB_KEY=your_github_key ./build/github_release.sh
11
11
# Before running this script, you will need to run "npm run build"
12
12
13
- if [[ -n " ${TRAVIS_TAG} " && " ${TRAVIS_BRANCH} " = " master " ]]
13
+ if [[ -n " ${TRAVIS_TAG} " && ${TRAVIS_TAG} =~ ^v[0-9]+ \. [0-9]+ \. [0-9]+$ ]]
14
14
then
15
+ echo " Creating release on GitHub for tag ${TRAVIS_TAG} "
15
16
zip_file=$TRAVIS_TAG .zip
16
17
17
18
# Zip the dist folder
20
21
# Create a release on GitHub
21
22
release=$( curl -s -d " {\" tag_name\" : \" $TRAVIS_TAG \" }" -H " Authorization: token ${GITHUB_KEY} " -X POST " https://api.github.com/repos/SPANDigital/presidium-js/releases" )
22
23
24
+ if [[ $( echo $release | jq -r ' .message' ) = " Not Found" ]]
25
+ then
26
+ echo " Error creating release on GitHub"
27
+ exit 1
28
+ fi
29
+
23
30
# Get the upload url from the release
24
31
upload_url=$( echo $release | jq -r ' .upload_url' )
25
32
26
33
# Remove the {?name,label} from the upload_url
27
34
upload_url=" ${upload_url// \{ ?name,label\} / } "
28
35
36
+ if [[ -z " $upload_url " ]]
37
+ then
38
+ echo " Error getting upload url from GitHub"
39
+ exit 1
40
+ fi
41
+
29
42
# Upload the zip file to the release
30
43
curl -s -H " Authorization: token ${GITHUB_KEY} " -H " Content-Type: application/zip" --data-binary @$zip_file " $upload_url ?name=$zip_file "
31
44
You can’t perform that action at this time.
0 commit comments