-
Notifications
You must be signed in to change notification settings - Fork 22
155 lines (127 loc) · 4.75 KB
/
testnet-deployment.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
name: Testnet Deployment
# This workflow:
# - Deploys the contracts to the Liquity v2 Testnet
# - Deploys the app to Vercel (main branch only, not PRs)
# - Deploys the gallery to Vercel (main branch only, not PRs)
on:
push:
branches: [main, dev]
paths:
- ".github/workflows/testnet-deployment.yml"
- "contracts/**"
- "frontend/**"
pull_request:
paths:
- ".github/workflows/testnet-deployment.yml"
- "contracts/**"
env:
CI: true
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
FOUNDRY_VERSION: nightly
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
deploy-contracts:
if: false # Contracts can no longer be deployed to Erigon dev chain because it doesn't support recent hardforks
name: Deploy contracts
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install pnpm
uses: pnpm/[email protected]
with:
version: 8
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
cache: "pnpm"
cache-dependency-path: "pnpm-lock.yaml"
- name: Install dependencies
run: pnpm install --frozen-lockfile
working-directory: ./contracts
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: ${{ env.FOUNDRY_VERSION }}
- name: Run deployment tool
working-directory: ./contracts
run: ./deploy liquity-testnet --debug --verify
timeout-minutes: 10
env:
DEPLOYER: ${{ secrets.DEPLOYER }}
- name: Upload deployment context
uses: actions/upload-artifact@v4
with:
name: deployment-context
path: ./contracts/deployment-context-latest.json
deploy-app:
name: Deploy app
runs-on: ubuntu-latest
needs: deploy-contracts
if: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
env:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/[email protected]
with:
version: 8
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install Vercel CLI
run: pnpm install --global vercel@canary
- name: Download deployment context
uses: actions/download-artifact@v4
with:
name: deployment-context
path: ./contracts
- name: Prepare Environment from Latest Deployment Context
working-directory: ./contracts
env:
APP_ENV_FILE: ../frontend/app/.env.local
DEPLOYMENT_CONTEXT_FILE: ./deployment-context-latest.json
run: |
echo 'NEXT_PUBLIC_CHAIN_ID=1337' >> $APP_ENV_FILE
echo 'NEXT_PUBLIC_CHAIN_NAME=Liquity Testnet' >> $APP_ENV_FILE
echo 'NEXT_PUBLIC_CHAIN_CURRENCY=Ether|ETH|18' >> $APP_ENV_FILE
echo 'NEXT_PUBLIC_CHAIN_RPC_URL=https://testnet.liquity.org/rpc' >> $APP_ENV_FILE
echo 'NEXT_PUBLIC_CHAIN_BLOCK_EXPLORER=Liquity Testnet|https://testnet.liquity.org/' >> $APP_ENV_FILE
echo 'NEXT_PUBLIC_CHAIN_CONTRACT_MULTICALL=0xffB2BAa708261533b51D18394fd8AFd0E32aBC55|488' >> $APP_ENV_FILE
pnpm tsx utils/deployment-artifacts-to-app-env.ts $DEPLOYMENT_CONTEXT_FILE $APP_ENV_FILE --append
cat $APP_ENV_FILE
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
deploy-gallery:
name: Deploy gallery
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' }}
env:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_GALLERY_PROJECT_ID }}
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/[email protected]
with:
version: 8
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install Vercel CLI
run: pnpm install --global vercel@canary
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}