[ci] Move repeated artifact upload job code to script

This commit is contained in:
Caleb Maclennan 2020-09-11 17:23:00 +03:00
parent 65be538fff
commit f4dea33f6d
No known key found for this signature in database
GPG Key ID: 63CC496475267693
2 changed files with 25 additions and 17 deletions

20
.ci/publish_release_artifact.sh Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -e
set -o pipefail
if [[ -z $GITHUB_TOKEN ]]; then
echo "No GITHUB_TOKEN secret found, artifact publishing skipped"
exit
fi
mkdir -p $HOME/.local/bin
export _GHR_VER=v0.13.0
export _GHR=ghr_${_GHR_VER}_linux_amd64
curl -sfL https://github.com/tcnksm/ghr/releases/download/$_GHR_VER/$_GHR.tar.gz |
tar xz -C $HOME/.local/bin --strip-components=1 $_GHR/ghr
ghr -replace \
-u $CIRCLE_PROJECT_USERNAME \
-r $CIRCLE_PROJECT_REPONAME \
$CIRCLE_TAG \
$1

View File

@ -75,17 +75,11 @@ jobs:
publish-dist:
executor: autotools-executor
steps:
- checkout
- attach_workspace:
at: .
- run: |
if [[ -n $GITHUB_TOKEN ]]; then
export _GHR=ghr_v0.13.0_linux_amd64
curl -sL https://github.com/tcnksm/ghr/releases/download/v0.13.0/$_GHR.tar.gz | tar xz --strip-components=1 $_GHR/ghr
echo TOKEN IS = $GITHUB_TOKEN
./ghr -replace -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME $CIRCLE_TAG harfbuzz-$CIRCLE_TAG.tar.xz
else
echo "No GITHUB_TOKEN secret found, artifact publishing skipped"
fi
.ci/publish_release_artifact.sh harfbuzz-$CIRCLE_TAG.tar.xz
fedora-valgrind:
docker:
@ -164,18 +158,12 @@ jobs:
publish-win32:
executor: win32-executor
steps:
- checkout
- attach_workspace:
at: .
- run: |
if [[ -n $GITHUB_TOKEN ]]; then
export _GHR=ghr_v0.13.0_linux_amd64
curl -sL https://github.com/tcnksm/ghr/releases/download/v0.13.0/$_GHR.tar.gz | tar xz --strip-components=1 $_GHR/ghr
mv harfbuzz-win32{,-$CIRCLE_TAG}.zip
echo TOKEN IS = $GITHUB_TOKEN
./ghr -replace -u $CIRCLE_PROJECT_USERNAME -r $CIRCLE_PROJECT_REPONAME $CIRCLE_TAG harfbuzz-win32-$CIRCLE_TAG.zip
else
echo "No GITHUB_TOKEN secret found, artifact publishing skipped"
fi
mv harfbuzz-win32{,-$CIRCLE_TAG}.zip
.ci/publish_release_artifact.sh harfbuzz-win32-$CIRCLE_TAG.zip
workflows:
version: 2