Adding circle ci job to push the wasm artifacts to github releases (#280)

* Adding circle ci job to push the wasm artifacts to github releases.
* Updated config.yml
This commit is contained in:
Andre Natal 2021-12-17 15:05:11 -08:00 committed by GitHub
parent 8884b39055
commit 793d132b7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,8 +11,9 @@ jobs:
- checkout
- run:
name: Build WASM
command: bash build-wasm.sh WORMHOLE
name: Build WASM WORMHOLE
command: |
bash build-wasm.sh WORMHOLE
- run:
name: Check artifacts
@ -22,11 +23,21 @@ jobs:
if ls bergamot*.wasm &>/dev/null && ls bergamot*.js &>/dev/null
then
echo "Artifacts Successfully Generated"
mkdir ../artifacts
cp bergamot-translator-worker.wasm ../artifacts/bergamot-translator-worker-with-wormhole.wasm
cp bergamot-translator-worker.js ../artifacts/bergamot-translator-worker-with-wormhole.js
shasum -a 256 ../artifacts/* > ../artifacts/SHA256-1
cp ../BERGAMOT_VERSION ../artifacts/
else
echo "Failure: Artifacts Not Present"
exit 1
fi
- persist_to_workspace:
root: .
paths:
- artifacts/*
- store_artifacts:
path: "build-wasm"
destination: "wasm-wormhole"
@ -43,7 +54,8 @@ jobs:
- run:
name: Build WASM
command: bash build-wasm.sh
command: |
bash build-wasm.sh
- run:
name: Check artifacts
@ -53,17 +65,61 @@ jobs:
if ls bergamot*.wasm &>/dev/null && ls bergamot*.js &>/dev/null
then
echo "Artifacts Successfully Generated"
mkdir ../artifacts
cp bergamot-translator-worker.wasm ../artifacts/bergamot-translator-worker-without-wormhole.wasm
cp bergamot-translator-worker.js ../artifacts/bergamot-translator-worker-without-wormhole.js
shasum -a 256 ../artifacts/* > ../artifacts/SHA256-2
else
echo "Failure: Artifacts Not Present"
exit 1
fi
- persist_to_workspace:
root: .
paths:
- artifacts/*
- store_artifacts:
path: "build-wasm"
destination: "wasm-without-wormhole"
publish_to_github:
docker:
- image: cibuilds/github:0.10
steps:
- attach_workspace:
# Must be absolute path or relative path from working_directory
at: ./
- run:
name: "Publish Release on GitHub"
command: |
export COMMIT=$(echo $CIRCLE_SHA1 | cut -c -7)
export VERSION=$(cat ./artifacts/BERGAMOT_VERSION | cut -c 2-)
VERSION=$VERSION+$COMMIT
ls -lsa ./artifacts/ > ./artifacts/FILESIZES
cat ./artifacts/SHA256-1 ./artifacts/SHA256-2 > ./artifacts/SHA256
rm ./artifacts/SHA256-1
rm ./artifacts/SHA256-2
rm ./artifacts/BERGAMOT_VERSION
ghr -t ${GHTOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${VERSION} ./artifacts/
workflows:
build:
jobs:
- build-with-wormhole
- build-without-wormhole
- build-with-wormhole:
filters:
tags:
only: /^v.*/
- build-without-wormhole:
filters:
tags:
only: /^v.*/
- publish_to_github:
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
requires:
- build-without-wormhole
- build-with-wormhole