-
Notifications
You must be signed in to change notification settings - Fork 3
191 lines (158 loc) · 5.54 KB
/
deploy.yml
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: Smart Contract Deployment
on:
push:
branches: [ "main", "curator" ]
env:
FOUNDRY_PROFILE: ci
jobs:
check:
name: Foundry project
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Install Dependencies
run: forge install
- name: Run tests
run: |
forge build --sizes
forge test -vvv
id: test
- name: Run snapshot
run: |
forge snapshot
id: snapshot
deploy-mainnet-beta:
needs: check
if: |
(github.event_name == 'push' && github.ref == 'refs/heads/curator') ||
(github.event_name == 'pull_request' && github.base_ref == 'curator')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Set up environment
run: |
echo "PRIVATE_KEY=${{ secrets.PRIVATE_KEY }}" >> .env
echo "BASE_RPC_URL=${{ secrets.BASE_RPC_URL }}" >> .env
echo "BASESCAN_API_KEY=${{ secrets.BASESCAN_API_KEY }}" >> .env
- name: Make deploy script executable
run: chmod +x ./shell/deploy.sh
- name: Deploy to Mainnet Beta
run: |
echo -e "\n" | ./shell/deploy.sh --network=base | tee deployment.log
env:
CI: true
- name: Extract Contract Addresses
if: success()
run: |
mkdir -p deployments/beta
grep "Contract deployed at:" deployment.log | while read -r line; do
CONTRACT_NAME=$(echo $line | cut -d' ' -f1)
ADDRESS=$(echo $line | cut -d' ' -f4)
echo "$ADDRESS" > "deployments/beta/${CONTRACT_NAME}.addr"
done
- name: Update Documentation
if: success()
run: |
mkdir -p docs/src
cat > docs/src/deployments-beta.md << EOF
# Beta Deployments
Network: Base Mainnet (Beta)
| Contract | Address | Verify |
|----------|---------|--------|
$(grep "Contract deployed at:" deployment.log | while read -r line; do
CONTRACT_NAME=$(echo $line | cut -d' ' -f1)
ADDRESS=$(echo $line | cut -d' ' -f4)
echo "| $CONTRACT_NAME | [\`$ADDRESS\`](https://basescan.org/address/$ADDRESS) | [Source](https://basescan.org/address/$ADDRESS#code) |"
done)
Last updated: $(date -u)
EOF
deploy-mainnet:
needs: check
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
cache: false
- name: Set up environment
run: |
echo "PRIVATE_KEY=${{ secrets.PRIVATE_KEY }}" >> .env
echo "BASE_RPC_URL=${{ secrets.BASE_RPC_URL }}" >> .env
echo "BASESCAN_API_KEY=${{ secrets.BASESCAN_API_KEY }}" >> .env
- name: Make base deploy script executable
run: chmod +x ./shell/deploy.base.sh
- name: Make deploy script executable
run: chmod +x ./shell/deploy.sh
- name: Deploy to Mainnet
run: |
echo -e "\n" | ./shell/deploy.sh --network=base | tee deployment.log
env:
CI: true
- name: Extract Contract Addresses
if: success()
run: |
mkdir -p deployments/mainnet
grep "Contract deployed at:" deployment.log | while read -r line; do
CONTRACT_NAME=$(echo $line | cut -d' ' -f1)
ADDRESS=$(echo $line | cut -d' ' -f4)
echo "$ADDRESS" > "deployments/mainnet/${CONTRACT_NAME}.addr"
done
- name: Update Documentation
if: success()
run: |
mkdir -p docs/src
cat > docs/src/deployments-mainnet.md << EOF
# Mainnet Deployments
Network: Base Mainnet
| Contract | Address | Verify |
|----------|---------|--------|
$(grep "Contract deployed at:" deployment.log | while read -r line; do
CONTRACT_NAME=$(echo $line | cut -d' ' -f1)
ADDRESS=$(echo $line | cut -d' ' -f4)
echo "| $CONTRACT_NAME | [\`$ADDRESS\`](https://basescan.org/address/$ADDRESS) | [Source](https://basescan.org/address/$ADDRESS#code) |"
done)
Last updated: $(date -u)
EOF
- name: Save Deployment Artifacts
if: success()
run: |
mkdir -p deployments
cp broadcast/contracts.s.sol/*.json deployments/
cp docs/src/deployments-mainnet.md deployments/
- name: Upload Deployment Artifacts
uses: actions/upload-artifact@v3
with:
name: deployment-artifacts
path: deployments/
- name: Create Release
if: success()
uses: softprops/action-gh-release@v1
with:
files: |
deployments/*.json
deployments/deployments-mainnet.md
name: Release ${{ github.sha }}
body: |
Base Mainnet Deployment
Commit: ${{ github.sha }}
See deployments-mainnet.md for contract addresses.
draft: false
prerelease: false