Skip to content

Commit

Permalink
generalising travis ci by using global vars
Browse files Browse the repository at this point in the history
  • Loading branch information
dimchansky committed Jan 3, 2019
1 parent fa7a14d commit c2efefb
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ cache:
directories:
- node_modules

env:
global:
- ARTIFACTS_DIR=artifacts
- ARTIFACT_NAME=reputation-contracts
- ARTIFACT_EXT=zip

before_install:
- sudo apt-get -qq update
- sudo apt-get install -y jq
Expand All @@ -22,33 +28,33 @@ script:
after_success:
- for file in build/contracts/*.json; do jq '.abi' < "$file" > "${file%.json}.abi"; done
- for file in build/contracts/*.json; do jq -r '.bytecode' < "$file" > "${file%.json}.bin"; done
- mkdir artifacts && for solfile in contracts/*.sol; do ./node_modules/.bin/truffle-flattener $solfile > artifacts/${solfile##*/}; done
- for file in contracts/*.sol; do f=$(basename -- ${file%.*}); cp "build/contracts/${f}.abi" artifacts/; cp "build/contracts/${f}.bin" artifacts/; done
- 'echo "Compiler: $(./node_modules/.bin/solcjs --version)" > artifacts/README.md'
- 'echo "Contracts commit: ${TRAVIS_COMMIT}" >> artifacts/README.md'
- pushd artifacts; zip -r reputation-contracts.zip .; popd
- 'echo "Artifacts download URL: https://${ARTIFACTS_BUCKET}.s3.amazonaws.com/${TRAVIS_REPO_SLUG}/${TRAVIS_COMMIT}/reputation-contracts.zip"'
- mkdir ${ARTIFACTS_DIR} && for solfile in contracts/*.sol; do ./node_modules/.bin/truffle-flattener $solfile > ${ARTIFACTS_DIR}/${solfile##*/}; done
- for file in contracts/*.sol; do f=$(basename -- ${file%.*}); cp "build/contracts/${f}.abi" ${ARTIFACTS_DIR}/; cp "build/contracts/${f}.bin" ${ARTIFACTS_DIR}/; done
- 'echo "Compiler: $(./node_modules/.bin/solcjs --version)" > ${ARTIFACTS_DIR}/README.md'
- 'echo "Contracts commit: ${TRAVIS_COMMIT}" >> ${ARTIFACTS_DIR}/README.md'
- pushd ${ARTIFACTS_DIR}; zip -r ${ARTIFACT_NAME}.${ARTIFACT_EXT} .; popd
- 'echo "Artifacts download URL: https://${ARTIFACTS_BUCKET}.s3.amazonaws.com/${TRAVIS_REPO_SLUG}/${TRAVIS_COMMIT}/${ARTIFACT_NAME}.${ARTIFACT_EXT}"'

addons:
artifacts:
s3_region: "eu-west-1"
working_dir: artifacts
s3_region: ${ARTIFACTS_S3_REGION}
working_dir: ${ARTIFACTS_DIR}
paths:
- reputation-contracts.zip
- ${ARTIFACT_NAME}.${ARTIFACT_EXT}
target_paths:
- /$TRAVIS_REPO_SLUG/$TRAVIS_COMMIT
- /${TRAVIS_REPO_SLUG}/${TRAVIS_COMMIT}

before_deploy:
- cp artifacts/reputation-contracts.zip artifacts/reputation-contracts-${TRAVIS_TAG}.zip
- cp ${ARTIFACTS_DIR}/${ARTIFACT_NAME}.${ARTIFACT_EXT} ${ARTIFACTS_DIR}/${ARTIFACT_NAME}-${TRAVIS_TAG}.${ARTIFACT_EXT}

deploy:
provider: releases
api_key:
secure: xIhJUx8tzIgC5skh7gIWHz7NLHy6H5K/xrESLN1KqktTvFURKsFwLkAusKpce163g1DqvgeKYhd2rXcvsc8rqMBibLEA2FVJCbeAKcXjhxWXV+TlbarQdFIZSYKqNMwxu82YjfN16ITJO2MtSUepmax0tTPdtK03U6j1ZlNrlthJi62hLTc6vxEXL66FNY8JxtkTmY9jdqnHZhwMDefGRCFdK+5DqBSIIe+VEqeCGoYWQcZzkNZZk6nVO5/CzufpdfDPuWSX1fw+OchY0yI/txSJacDEqLmLXuW7WWRuT8CD7EdIzBT6FKUWfI5omGP04co4eR38WTuP3YnVr4T1O3ENw6QAPHgxCE2mmAFi4WYI88RVzHBtsNWnlXcsN+1gb9zj61yPntMQqZgOtvblJTqynBXcG2F1iWk6v8fhdPZudlkuAWdozON+IpxDYvktHpiRBRaZGeOuYzLL4Z3rbntrOYMYkr3JEbKq+lt3hpSS9TpDRtwXpLwX6bGuJQcZYouq6TG7R1SW1aLpP5VDH4FlENlNFchcDV5d2cNuuRNZ2dXzyt4BryW3K9dHeXxaY5ZF546k8tSLtH71nM0nZBNBxHfSjBnZYay5ja+HCPipIqx2hChwVe3M+evJevmtuPGh0MshtPJWf4lgb7xIbxT1mOWNARzIzFYUg5i43eE=
file: artifacts/reputation-contracts-${TRAVIS_TAG}.zip
file: ${ARTIFACTS_DIR}/${ARTIFACT_NAME}-${TRAVIS_TAG}.${ARTIFACT_EXT}
skip_cleanup: true
overwrite: true
draft: true
on:
repo: monetha/reputation-contracts
repo: ${TRAVIS_REPO_SLUG}
tags: true

0 comments on commit c2efefb

Please sign in to comment.