22
33REPO=" $1 "
44TAG=" $2 "
5- AUTH_TOKEN=" $3 "
5+ AUTH_TOKEN=" $( < ' /home/buildbot/.github_token ' ) "
66
77PRERELEASE=false
88# RELEASEFILES=(debs/python-probe_basic_*.deb dist/probe_basic-*.tar.gz)
@@ -27,7 +27,8 @@ declare -a COMMIT_TYPES=(
2727" REV:Reverted commits"
2828)
2929
30- LAST_RELEASE=$( git describe --abbrev=0 --tags ` git rev-list --tags --skip=1 --max-count=1` )
30+ # shellcheck disable=SC2046
31+ LAST_RELEASE=$( git describe --abbrev=0 --tags " $( git rev-list --tags --skip=1 --max-count=1) " )
3132
3233CREATE_CHANGELOG () {
3334
@@ -138,16 +139,16 @@ JSON=$(cat <<EOF
138139}
139140EOF
140141)
141- RESULT=` curl -s -w " \n%{http_code}\n" \
142+ RESULT=$( curl -s -w " \n%{http_code}\n" \
142143 -H " Authorization: token $AUTH_TOKEN " \
143144 -d " $JSON " \
144- " https://api.github.com/repos/$REPO /releases" `
145- if [ " ` echo " $RESULT " | tail -1` " != " 201" ]; then
145+ " https://api.github.com/repos/$REPO /releases" )
146+ if [ " $( echo " $RESULT " | tail -1) " != " 201" ]; then
146147 echo FAILED
147148 echo " $RESULT "
148149 exit 1
149150fi
150- RELEASEID=` echo " $RESULT " | sed -ne ' s/^ "id": \(.*\),$/\1/p' `
151+ RELEASEID=$( echo " $RESULT " | sed -ne ' s/^ "id": \(.*\),$/\1/p' )
151152if [[ -z " $RELEASEID " ]]; then
152153 echo FAILED
153154 echo " $RESULT "
@@ -160,16 +161,17 @@ for FILE in "${RELEASEFILES[@]}"; do
160161 echo " Warning: $FILE is not a file"
161162 continue
162163 fi
163- FILESIZE=` stat -c ' %s' " $FILE " `
164- FILENAME=` basename $FILE `
164+ FILESIZE=$( stat -c ' %s' " $FILE " )
165+ # shellcheck disable=SC2006
166+ FILENAME=` basename " $FILE " `
165167 echo -n " Uploading $FILENAME ... "
166- RESULT=` curl -s -w " \n%{http_code}\n" \
168+ RESULT=$( curl -s -w " \n%{http_code}\n" \
167169 -H " Authorization: token $AUTH_TOKEN " \
168170 -H " Accept: application/vnd.github.manifold-preview" \
169171 -H " Content-Type: application/zip" \
170172 --data-binary " @$FILE " \
171- " https://uploads.github.com/repos/$REPO /releases/$RELEASEID /assets?name=$FILENAME &size=$FILESIZE " `
172- if [ " ` echo " $RESULT " | tail -1` " != " 201" ]; then
173+ " https://uploads.github.com/repos/$REPO /releases/$RELEASEID /assets?name=$FILENAME &size=$FILESIZE " )
174+ if [ " $( echo " $RESULT " | tail -1) " != " 201" ]; then
173175 echo FAILED
174176 echo " $RESULT "
175177 exit 1
@@ -184,12 +186,12 @@ JSON=$(cat <<EOF
184186}
185187EOF
186188)
187- RESULT=` curl -s -w " \n%{http_code}\n" \
189+ RESULT=$( curl -s -w " \n%{http_code}\n" \
188190 -X PATCH \
189191 -H " Authorization: token $AUTH_TOKEN " \
190192 -d " $JSON " \
191- " https://api.github.com/repos/$REPO /releases/$RELEASEID " `
192- if [ " ` echo " $RESULT " | tail -1` " = " 200" ]; then
193+ " https://api.github.com/repos/$REPO /releases/$RELEASEID " )
194+ if [ " $( echo " $RESULT " | tail -1) " = " 200" ]; then
193195 echo DONE
194196else
195197 echo FAILED
0 commit comments