-
-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (82 loc) · 2.33 KB
/
Copy pathdeploy.yml
File metadata and controls
104 lines (82 loc) · 2.33 KB
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
98
99
100
101
102
103
104
name: Deploy
on:
push:
branches: [ main, master ]
tags: [ 'v*' ]
release:
types: [ published ]
env:
NODE_ENV: production
jobs:
deploy-testnet:
name: Deploy to Testnet
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
environment: testnet
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Compile contracts
run: npm run compile
- name: Deploy to Sepolia
run: npm run deploy:sepolia
env:
SEPOLIA_URL: ${{ secrets.SEPOLIA_URL }}
SEPOLIA_PRIVATE_KEY: ${{ secrets.SEPOLIA_PRIVATE_KEY }}
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}
publish-package:
name: Publish to NPM
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
needs: [deploy-testnet]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Compile contracts
run: npm run compile
- name: Build package
run: npm run build
- name: Run tests
run: npm test
- name: Publish to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
deploy-mainnet:
name: Deploy to Mainnet
runs-on: ubuntu-latest
if: github.event_name == 'release'
environment: mainnet
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Compile contracts
run: npm run compile
- name: Deploy to Mainnet
run: npm run deploy:mainnet
env:
MAINNET_URL: ${{ secrets.MAINNET_URL }}
MAINNET_PRIVATE_KEY: ${{ secrets.MAINNET_PRIVATE_KEY }}
ETHERSCAN_API_KEY: ${{ secrets.ETHERSCAN_API_KEY }}