From 4c78e07f6667b5c2879b29c0b5872ff3d9e4a068 Mon Sep 17 00:00:00 2001 From: devcarrot Date: Sat, 5 Jun 2021 14:25:05 -0600 Subject: [PATCH] Only deploy on release This changes the Rinkeby deploy behavior to only ocurr on release creation. To reduce excess deployments. --- .github/pull_request_template.md | 14 ------ .github/workflows/contract-deployment.yaml | 55 ++++++++++++++++++++++ .github/workflows/contracts.yaml | 32 ------------- 3 files changed, 55 insertions(+), 46 deletions(-) delete mode 100644 .github/pull_request_template.md create mode 100644 .github/workflows/contract-deployment.yaml diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index a9ac665e61..0000000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,14 +0,0 @@ -## Description - - - -## Deployed Contract - - - -Rinkeby contract address `ADDRESS_HERE` \ No newline at end of file diff --git a/.github/workflows/contract-deployment.yaml b/.github/workflows/contract-deployment.yaml new file mode 100644 index 0000000000..ea4434166b --- /dev/null +++ b/.github/workflows/contract-deployment.yaml @@ -0,0 +1,55 @@ +name: Contracts CD + +on: + release: + types: + - created + +jobs: + build_and_test: + name: Build and Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Use Node.js 14.x + uses: actions/setup-node@v1 + with: + node-version: 14.x + - run: yarn + - run: yarn build + - name: Run contract tests + run: | + cd packages/nouns-contracts + yarn test + build_and_deploy: + name: Build and Deploy + needs: build_and_test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Use Node.js 14.x + uses: actions/setup-node@v1 + with: + node-version: 14.x + - run: yarn + - run: yarn build + - name: Deploy contract to Rinkeby + env: + INFURA_PROJECT_ID: ${{ secrets.INFURA_PROJECT_ID }} + MNEMONIC: ${{ secrets.MNEMONIC }} + run: | + cd packages/nouns-contracts + npx hardhat run --network rinkeby scripts/deploy-ci.ts + - name: Verify contract on Etherscan + env: + INFURA_PROJECT_ID: ${{ secrets.INFURA_PROJECT_ID }} + ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }} + run: | + cd packages/nouns-contracts + echo "Giving Etherscan time to index" + sleep 60 # This could be replaced by polling etherscan on that address, wait for non-404 + npx hardhat verify --network rinkeby `cat logs/deploy.json| jq -r '.contractAddress'` + - name: Look here for contract info + run: | + cd packages/nouns-contracts + echo "Contract deployed on Rinkeby to `cat logs/deploy.json| jq -r '.contractAddress'`" diff --git a/.github/workflows/contracts.yaml b/.github/workflows/contracts.yaml index 41ef50b2b8..e32567a3ce 100644 --- a/.github/workflows/contracts.yaml +++ b/.github/workflows/contracts.yaml @@ -24,35 +24,3 @@ jobs: run: | cd packages/nouns-contracts yarn test - build_and_deploy: - name: Build and Deploy - needs: build_and_test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Use Node.js 14.x - uses: actions/setup-node@v1 - with: - node-version: 14.x - - run: yarn - - run: yarn build - - name: Deploy contract to Rinkeby - env: - INFURA_PROJECT_ID: ${{ secrets.INFURA_PROJECT_ID }} - MNEMONIC: ${{ secrets.MNEMONIC }} - run: | - cd packages/nouns-contracts - npx hardhat run --network rinkeby scripts/deploy-ci.ts - - name: Verify contract on Etherscan - env: - INFURA_PROJECT_ID: ${{ secrets.INFURA_PROJECT_ID }} - ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }} - run: | - cd packages/nouns-contracts - echo "Giving Etherscan time to index" - sleep 60 # This could be replaced by polling etherscan on that address, wait for non-404 - npx hardhat verify --network rinkeby `cat logs/deploy.json| jq -r '.contractAddress'` - - name: Look here for contract info - run: | - cd packages/nouns-contracts - echo "Contract deployed on Rinkeby to `cat logs/deploy.json| jq -r '.contractAddress'`"