message: Add deployment job
diff: @@ -15,6 +15,7 @@ workflows:
  - contract_staking
  - fmt
  - clippy
  + - deploy
  jobs:
  package_schema:
  @@ -577,3 +578,53 @@ jobs:
  - contracts/staking/target/debug/build
  - contracts/staking/target/debug/deps
  key: cargocache-v2-clippy-rust:1.41.1-{{ checksum "Cargo.lock" }}-{{ checksum "contracts/hackatom/Cargo.lock" }}-{{ checksum "contracts/queue/Cargo.lock" }}-{{ checksum "contracts/reflect/Cargo.lock" }}-{{ checksum "contracts/staking/Cargo.lock" }}
  +
  + # This job roughly follows the instructions from https://circleci.com/blog/publishing-to-github-releases-via-circleci/
  + deploy:
  + docker:
  + # Image from https://github.com/cibuilds/github, based on alpine
  + - image: cibuilds/github:0.13
  + steps:
  + - run:
  + name: Install Docker client
  + command: apk add docker-cli
  + - setup_remote_docker
  + - checkout
  + - run:
  + name: Create atrifacts directory
  + command: mkdir ./artifacts
  + - run:
  + # We cannot mount local folders, see https://circleci.com/docs/2.0/building-docker-images/#mounting-folders
  + name: Prepare volume with source code
  + command: |
  + # create a dummy container which will hold a volume with config
  + docker create -v /code --name with_code alpine /bin/true
  + # copy a config file into this volume
  + docker cp ./contracts with_code:/code
  + docker cp ./packages with_code:/code
  + - run:
  + name: Build development contracts
  + command: |
  + for contract_dir in ./contracts/*/; do
  + name=$(basename $contract_dir)
  + echo "Building $name ..."
  + docker run --volumes-from with_code cosmwasm/rust-optimizer:0.8.0 ./contracts/$name
  + docker cp with_code:/code/contracts/$name/contract.wasm ./artifacts/$name.wasm
  + done
  + - run:
  + name: Create checksums
  + working_directory: artifacts
  + command: sha256sum *.wasm > checksums.sha256 && cat checksums.sha256
  + - run:
  + name: Publish artifacts on GitHub
  + command: |
  + VERSION="0.0.1234"
  + TAG="v$VERSION"
  + TITLE="$TAG"
  + BODY="Attached there are some build artifacts generated at this tag. Those are for development purposes only! Please use crates.io to find the packages of this release."
  + ghr -t "$GITHUB_TOKEN" \
  + -u "$CIRCLE_PROJECT_USERNAME" -r "$CIRCLE_PROJECT_REPONAME" \
  + -c "$CIRCLE_SHA1" \
  + -n "$TITLE" -b "$BODY" \
  + -delete \
  + "$TAG" ./artifacts/
  