[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: publish-dist:
executor: autotools-executor executor: autotools-executor
steps: steps:
- checkout
- attach_workspace: - attach_workspace:
at: . at: .
- run: | - run: |
if [[ -n $GITHUB_TOKEN ]]; then .ci/publish_release_artifact.sh harfbuzz-$CIRCLE_TAG.tar.xz
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
fedora-valgrind: fedora-valgrind:
docker: docker:
@ -164,18 +158,12 @@ jobs:
publish-win32: publish-win32:
executor: win32-executor executor: win32-executor
steps: steps:
- checkout
- attach_workspace: - attach_workspace:
at: . at: .
- run: | - run: |
if [[ -n $GITHUB_TOKEN ]]; then mv harfbuzz-win32{,-$CIRCLE_TAG}.zip
export _GHR=ghr_v0.13.0_linux_amd64 .ci/publish_release_artifact.sh harfbuzz-win32-$CIRCLE_TAG.zip
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
workflows: workflows:
version: 2 version: 2