generated from NodeFactoryIo/solidity-contracts-starter
-
Notifications
You must be signed in to change notification settings - Fork 10
97 lines (91 loc) · 3.08 KB
/
publish-contracts.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Release Contracts
on:
push:
branches:
- "master"
jobs:
tag:
name: Check and Tag
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create tag
id: tag
uses: butlerlogic/[email protected]
with:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
strategy: package # Optional, since "package" is the default strategy
tag_prefix: "v"
outputs:
tag: ${{ steps.tag.outputs.tagname }}
release-contracts:
name: Release Contracts
runs-on: ubuntu-latest
needs: tag
if: needs.tag.outputs.tag != ''
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Nodejs
uses: actions/setup-node@v1
with:
node-version: "12.x"
always-auth: true
registry-url: "https://npm.pkg.github.com"
scope: "@niftyhorde"
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install dependencies
run: yarn install --frozen-lockfile --non-interactive --ignore-optional
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare env
run: yarn run prepare
- name: Build packages
run: yarn run build
- name: Compile contracts
run: yarn run compile
- name: Deploy local
run: yarn run deploy:local
- name: Deploy goerli
run: yarn run deploy:goerli
env:
INFURA_PROJECT_ID: ${{ secrets.INFURA_PROJECT_ID }}
GOERLI_MNEMONIC: ${{ secrets.TESTNET_MNEMONIC }}
- name: Deploy rinkeby
run: yarn run deploy:rinkeby
env:
INFURA_PROJECT_ID: ${{ secrets.INFURA_PROJECT_ID }}
RINKEBY_MNEMONIC: ${{ secrets.TESTNET_MNEMONIC }}
- name: Deploy mainnet
run: yarn run deploy:mainnet
if: ${{ !contains(needs.tag.outputs.tag, 'beta') }}
env:
CONTRACT_OWNER_ADDRESS: ${{ secrets.CONTRACT_OWNER_ADDRESS }}
INFURA_PROJECT_ID: ${{ secrets.INFURA_PROJECT_ID }}
MAINNET_MNEMONIC: ${{ secrets.MAINNET_MNEMONIC }}
- name: Combine deployments
run: npx hardhat deploy --export-all "./deployments/deployments.json"
- name: Publish to github package registry
run: yarn publish --ignore-scripts --no-git-tag-version --no-commit-hooks --non-interactive
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.tag.outputs.tag }}
release_name: Release ${{ needs.tag.outputs.tag }}
#in case of failure
- name: Rollback on failure
if: failure()
uses: author/action-rollback@9ec72a6af74774e00343c6de3e946b0901c23013
with:
id: ${{ steps.create_release.outputs.id }}
tag: ${{ needs.tag.outputs.tag }}
delete_orphan_tag: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}