mirror of
https://github.com/browsermt/bergamot-translator.git
synced 2024-09-11 05:35:33 +03:00
Create github release via CircleCI only for mozilla fork (#349)
* Create github release via circleci only for mozilla fork - The extension uses mozilla fork for translator artifacts -- Hence create github release via circleci only when running in mozilla fork * Small refactoring in ci script
This commit is contained in:
parent
2844cedb0d
commit
6ccd4c68e8
@ -20,13 +20,18 @@ jobs:
|
|||||||
working_directory: build-wasm
|
working_directory: build-wasm
|
||||||
command: |
|
command: |
|
||||||
ARTIFACT_BASE="bergamot-translator-worker"
|
ARTIFACT_BASE="bergamot-translator-worker"
|
||||||
|
ARTIFACT_SUFFIX="with-wormhole"
|
||||||
|
ARTIFACT_FINAL=$ARTIFACT_BASE-$ARTIFACT_SUFFIX
|
||||||
|
|
||||||
if [[ -f "$ARTIFACT_BASE.js" && -f "$ARTIFACT_BASE.wasm" ]]; then
|
if [[ -f "$ARTIFACT_BASE.js" && -f "$ARTIFACT_BASE.wasm" ]]; then
|
||||||
echo "Artifacts Successfully Generated"
|
echo "Artifacts Successfully Generated"
|
||||||
mkdir ../artifacts
|
mkdir ../artifacts
|
||||||
cp $ARTIFACT_BASE.wasm ../artifacts/$ARTIFACT_BASE-with-wormhole.wasm
|
cp $ARTIFACT_BASE.wasm ../artifacts/$ARTIFACT_FINAL.wasm
|
||||||
cp $ARTIFACT_BASE.js ../artifacts/$ARTIFACT_BASE-with-wormhole.js
|
cp $ARTIFACT_BASE.js ../artifacts/$ARTIFACT_FINAL.js
|
||||||
shasum -a 256 ../artifacts/* > ../artifacts/SHA256-1
|
cd ../artifacts
|
||||||
cp ../BERGAMOT_VERSION ../artifacts/
|
shasum -a 256 $ARTIFACT_FINAL.wasm $ARTIFACT_FINAL.js >> sha256-filesize-$ARTIFACT_SUFFIX
|
||||||
|
ls -lsa $ARTIFACT_FINAL.wasm $ARTIFACT_FINAL.js >> sha256-filesize-$ARTIFACT_SUFFIX
|
||||||
|
cp ../BERGAMOT_VERSION .
|
||||||
else
|
else
|
||||||
echo "Failure: Artifacts Not Present"
|
echo "Failure: Artifacts Not Present"
|
||||||
exit 1
|
exit 1
|
||||||
@ -61,12 +66,17 @@ jobs:
|
|||||||
working_directory: build-wasm
|
working_directory: build-wasm
|
||||||
command: |
|
command: |
|
||||||
ARTIFACT_BASE="bergamot-translator-worker"
|
ARTIFACT_BASE="bergamot-translator-worker"
|
||||||
|
ARTIFACT_SUFFIX="without-wormhole"
|
||||||
|
ARTIFACT_FINAL=$ARTIFACT_BASE-$ARTIFACT_SUFFIX
|
||||||
|
|
||||||
if [[ -f "$ARTIFACT_BASE.js" && -f "$ARTIFACT_BASE.wasm" ]]; then
|
if [[ -f "$ARTIFACT_BASE.js" && -f "$ARTIFACT_BASE.wasm" ]]; then
|
||||||
echo "Artifacts Successfully Generated"
|
echo "Artifacts Successfully Generated"
|
||||||
mkdir ../artifacts
|
mkdir ../artifacts
|
||||||
cp $ARTIFACT_BASE.wasm ../artifacts/$ARTIFACT_BASE-without-wormhole.wasm
|
cp $ARTIFACT_BASE.wasm ../artifacts/$ARTIFACT_FINAL.wasm
|
||||||
cp $ARTIFACT_BASE.js ../artifacts/$ARTIFACT_BASE-without-wormhole.js
|
cp $ARTIFACT_BASE.js ../artifacts/$ARTIFACT_FINAL.js
|
||||||
shasum -a 256 ../artifacts/* > ../artifacts/SHA256-2
|
cd ../artifacts
|
||||||
|
shasum -a 256 $ARTIFACT_FINAL.wasm $ARTIFACT_FINAL.js >> sha256-filesize-$ARTIFACT_SUFFIX
|
||||||
|
ls -lsa $ARTIFACT_FINAL.wasm $ARTIFACT_FINAL.js >> sha256-filesize-$ARTIFACT_SUFFIX
|
||||||
else
|
else
|
||||||
echo "Failure: Artifacts Not Present"
|
echo "Failure: Artifacts Not Present"
|
||||||
exit 1
|
exit 1
|
||||||
@ -82,20 +92,23 @@ jobs:
|
|||||||
destination: "wasm-without-wormhole"
|
destination: "wasm-without-wormhole"
|
||||||
|
|
||||||
publish_to_github:
|
publish_to_github:
|
||||||
docker:
|
docker:
|
||||||
- image: cibuilds/github:0.10
|
- image: cibuilds/github:0.10
|
||||||
steps:
|
steps:
|
||||||
- attach_workspace:
|
- attach_workspace:
|
||||||
# Must be absolute path or relative path from working_directory
|
# Must be absolute path or relative path from working_directory
|
||||||
at: ./
|
at: ./
|
||||||
- run:
|
- when:
|
||||||
name: "Publish Release on GitHub"
|
condition:
|
||||||
command: |
|
equal: [ 'https://github.com/mozilla/bergamot-translator', << pipeline.project.git_url >> ]
|
||||||
export TAG_VERSION=$(cat ./artifacts/BERGAMOT_VERSION)
|
steps:
|
||||||
ls -lsa ./artifacts/ > ./artifacts/FILESIZES
|
- run:
|
||||||
cat ./artifacts/SHA256-1 ./artifacts/SHA256-2 > ./artifacts/SHA256
|
name: "Publish Release on GitHub"
|
||||||
rm ./artifacts/SHA256-1 ./artifacts/SHA256-2 ./artifacts/BERGAMOT_VERSION
|
command: |
|
||||||
ghr -t ${GHTOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${TAG_VERSION} ./artifacts/
|
export TAG_VERSION=$(cat ./artifacts/BERGAMOT_VERSION)
|
||||||
|
cat ./artifacts/sha256-filesize-without-wormhole ./artifacts/sha256-filesize-with-wormhole >> ./artifacts/sha256-filesize
|
||||||
|
rm ./artifacts/sha256-filesize-without-wormhole ./artifacts/sha256-filesize-with-wormhole ./artifacts/BERGAMOT_VERSION
|
||||||
|
ghr -t ${GHTOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -delete ${TAG_VERSION} ./artifacts/
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
build:
|
build:
|
||||||
|
Loading…
Reference in New Issue
Block a user