diff --git a/.circleci/announcePublish.sh b/.circleci/announcePublish.sh new file mode 100644 index 00000000..50a5a540 --- /dev/null +++ b/.circleci/announcePublish.sh @@ -0,0 +1,25 @@ +#!/bin/bash +set -euo pipefail + +applicationName=$1 +package=$2 + +payload=$( +cat < ~/etherspot-contracts/.npmrc + - restore_cache: + key: dependency-cache-{{ checksum "package.json" }} + - run: + name: Install dependencies + command: npm install + - save_cache: + key: dependency-cache-{{ checksum "package.json" }} + paths: + - ./node_modules + - slack/status: + fail_only: true + failure_message: "Triggered by: *${CIRCLE_USERNAME}* \n\n Ooops! The *$CIRCLE_JOB* job has failed! :circleci-fail:" + webhook: "${SLACK_WEBHOOK_URL}" + + publish: + working_directory: ~/etherspot-contracts + docker: + - image: circleci/node:14.17.0 + auth: + username: $DOCKERHUB_USER + password: $DOCKERHUB_PASSWORD + steps: + - checkout + - restore_cache: + key: dependency-cache-{{ checksum "package.json" }} + - run: + name: Authenticate with registry + command: echo "//registry.npmjs.org/:_authToken=$ETHERSPOT_NPM_TOKEN" > ~/etherspot-contracts/.npmrc + - run: + name: Build Etherpot contracts + command: npm run build + - run: + name: Publish package to npm + command: npm publish + - run: + name: Announce Publish + command: | + chmod +x .circleci/announcePublish.sh + .circleci/announcePublish.sh "Etherspot Contracts" "$(node -e "console.log(require('./package.json').version)")" + - slack/status: + fail_only: true + failure_message: "Triggered by: *${CIRCLE_USERNAME}* \n\n Ooops! The *$CIRCLE_JOB* job has failed! :circleci-fail:" + only_for_branches: master + webhook: "${SLACK_WEBHOOK_URL}" + publish-github-release: + docker: + - image: ardd97/ghr + steps: + - checkout + - run: + name: "Publish Release on GitHub" + command: | + PACKAGE_VERSION="$(jq .version package.json -r)" + echo $PACKAGE_VERSION + ghr -t "${GITHUB_TOKEN}" -u "${CIRCLE_PROJECT_USERNAME}" -r "${CIRCLE_PROJECT_REPONAME}" -c "${CIRCLE_SHA1}" "$PACKAGE_VERSION" + +workflows: + version: 2.1 + install_and_publish: + jobs: + - install: + context: general-vars + - publish: + context: general-vars + requires: + - install + filters: + branches: + only: + - master + - publish-github-release: + context: general-vars + filters: + branches: + only: + - master \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 2bcb3da7..ed79c126 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@etherspot/contracts", - "version": "1.5.0", + "version": "1.5.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@etherspot/contracts", - "version": "1.4.0", + "version": "1.5.1", "license": "MIT", "devDependencies": { "@nomiclabs/hardhat-etherscan": "2.1.7", diff --git a/package.json b/package.json index e0ac3314..6e726b9c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@etherspot/contracts", - "version": "1.5.0", + "version": "1.5.1", "description": "Etherspot Solidity contracts", "keywords": [ "ether",