-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from gnosis/feature/add-travis-ci
Add travis CI config and scripts
- Loading branch information
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
if: (branch = master) OR (branch = development) OR (tag IS present) | ||
language: node_js | ||
node_js: '12' | ||
before_install: | ||
- yarn install | ||
# Needed to deploy pull request and releases | ||
- pip install awscli --upgrade --user | ||
cache: | ||
yarn: true | ||
script: | | ||
echo "Skip tests" # no test cases for the project | ||
if [ -n "$TRAVIS_TAG" ] | ||
then | ||
# build project for NPM publishing -> content goes to /dist | ||
echo "Build NPM package" | ||
yarn build | ||
cd dist/ | ||
# https://classic.yarnpkg.com/en/docs/cli/pack/ | ||
yarn pack --filename safe-apps-sdk-$TRAVIS_TAG.tgz | ||
cd .. | ||
else | ||
echo "No tagged commit, won't build NPM lib" | ||
fi | ||
deploy: | ||
# Prepare production env deployment, no development deploy since the app | ||
# is a npm library | ||
- provider: s3 | ||
bucket: $STAGING_BUCKET_NAME | ||
access_key_id: $AWS_ACCESS_KEY_ID | ||
secret_access_key: $AWS_SECRET_ACCESS_KEY | ||
skip_cleanup: true | ||
local_dir: dist | ||
upload-dir: releases/$TRAVIS_TAG | ||
region: eu-central-1 | ||
on: | ||
tags: true | ||
|
||
- provider: script | ||
script: bash travis/prepare_production_deployment.sh | ||
on: | ||
tags: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
set -ev | ||
|
||
# Only: | ||
# - Tagged commits | ||
# - Security env variables are available. | ||
if [ -n "$TRAVIS_TAG" ] && [ -n "$PROD_DEPLOYMENT_HOOK_TOKEN" ] && [ -n "$PROD_DEPLOYMENT_HOOK_URL" ] | ||
then | ||
# Call Devops Releases Handler CI | ||
curl --silent --output /dev/null --write-out "%{http_code}" -X POST \ | ||
-F token="$PROD_DEPLOYMENT_HOOK_TOKEN" \ | ||
-F ref=master \ | ||
-F "variables[TRIGGER_RELEASE_COMMIT_TAG]=$TRAVIS_TAG" \ | ||
$PROD_DEPLOYMENT_HOOK_URL | ||
else | ||
echo "[ERROR] Production deployment could not be prepared" | ||
fi |