-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (114 loc) · 3.61 KB
/
deploy-devnet.yml
File metadata and controls
138 lines (114 loc) · 3.61 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
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
name: Deploy to Devnet
on:
workflow_dispatch:
inputs:
dry_run:
description: 'Dry run (build only, no deploy)'
type: boolean
default: false
env:
CARGO_TERM_COLOR: always
SOLANA_VERSION: 2.2.19
jobs:
build:
name: Build Program
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@master
with:
toolchain: '1.92'
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: 'pnpm'
- name: Install Solana CLI
run: |
sh -c "$(curl -sSfL https://release.anza.xyz/v${{ env.SOLANA_VERSION }}/install)"
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
- uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
- run: pnpm install
- name: Build program
run: |
pnpm run generate-idl
pnpm run generate-clients
cd program && cargo-build-sbf
- name: Upload program binary
uses: actions/upload-artifact@v4
with:
name: program-binary
path: target/deploy/escrow_program.so
- name: Upload IDL
uses: actions/upload-artifact@v4
with:
name: idl
path: idl/escrow_program.json
deploy:
name: Deploy to Devnet
needs: build
if: ${{ !inputs.dry_run }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: pnpm/action-setup@v4
- name: Download program binary
uses: actions/download-artifact@v4
with:
name: program-binary
path: target/deploy/
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v5
with:
path: ~/.txtx
key: txtx-${{ runner.os }}
- name: Install txtx
run: |
echo "$HOME/.txtx/bin" >> $GITHUB_PATH
export PATH="$HOME/.txtx/bin:$PATH"
if ! command -v txtx &> /dev/null; then
curl -sL https://install.txtx.sh/ | bash
fi
- name: Deploy to devnet
uses: nick-fields/retry@v3
with:
timeout_minutes: 10
max_attempts: 3
retry_wait_seconds: 30
command: txtx run deploy -e devnet -u
env:
DEVNET_RPC_URL: ${{ secrets.DEVNET_RPC_URL }}
DEPLOYER_SECRET_KEY: ${{ secrets.DEPLOYER_SECRET_KEY }}
- name: Download IDL
uses: actions/download-artifact@v4
with:
name: idl
path: idl/
- name: Write deployer keypair
run: echo '${{ secrets.DEPLOYER_SECRET_KEY }}' > deployer.json
- name: Deploy IDL
uses: nick-fields/retry@v3
with:
timeout_minutes: 5
max_attempts: 3
retry_wait_seconds: 30
command: |
pnpx @solana-program/program-metadata@0.5.1 write idl Escrowae7RaUfNn4oEZHywMXE5zWzYCXenwrCDaEoifg idl/escrow_program.json \
--keypair deployer.json \
--rpc ${{ secrets.DEVNET_RPC_URL }}
- name: Clean up keypair
if: always()
run: rm -f deployer.json
- name: Deployment Summary
if: success()
run: |
echo "## Deployment Complete" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Program deployed to **devnet**" >> $GITHUB_STEP_SUMMARY
echo "IDL deployed on-chain via Program Metadata Program" >> $GITHUB_STEP_SUMMARY