-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathaction.yml
105 lines (99 loc) · 3.52 KB
/
action.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
name: "Solana buffer deploy"
description: "Github action to deploy a program buffer on Solana"
author: "Cardinal Labs"
branding:
icon: "upload"
color: "red"
inputs:
network:
description: "The Solana network"
required: true
default: "devnet"
program:
description: "The program to build and upload"
required: true
program-id:
description: "The program id of the program we are uploading"
required: true
buffer-authority:
description: "The buffer authority to set"
required: true
keypair:
description: "The keypair to use for deploys"
required: true
outputs:
buffer:
description: "The buffer address"
value: ${{ steps.buffer-deploy.outputs.buffer }}
idl-buffer:
description: "The idl buffer address."
value: ${{ steps.buffer-deploy.outputs.idl-buffer }}
runs:
using: "composite"
steps:
- run: anchor build --verifiable -p $PROGRAM
shell: bash
env:
PROGRAM: ${{ inputs.program }}
- run: solana-keygen new -o buffer-keypair --no-bip39-passphrase
shell: bash
- run: echo "$KEYPAIR" > ./deploy-keypair.json && chmod 600 ./deploy-keypair.json
shell: bash
env:
KEYPAIR: ${{ inputs.keypair }}
- name: Buffer Deploy
uses: nick-invision/retry@v2
with:
timeout_minutes: 30
max_attempts: 10
shell: bash
command: solana program write-buffer --buffer ./buffer-keypair -k ./deploy-keypair.json ./target/verifiable/$PROGRAM.so -u $NETWORK > ./buffer.out
env:
NETWORK: ${{ inputs.network }}
PROGRAM: ${{ inputs.program }}
- name: IDL Buffer Deploy
uses: nick-invision/retry@v2
with:
timeout_minutes: 10
max_attempts: 10
shell: bash
command: anchor idl write-buffer $PROGRAM_ID --filepath ./target/idl/$PROGRAM.json --provider.cluster $NETWORK --provider.wallet ./deploy-keypair.json > idl-buffer.out
env:
PROGRAM_ID: ${{ inputs.program-id }}
PROGRAM: ${{ inputs.program }}
NETWORK: ${{ inputs.network }}
- name: Set buffer output
id: buffer-deploy
shell: bash
run: |
echo "buffer=$(cat buffer.out | sed 's/Buffer: //g' | xargs echo -n)" >> $GITHUB_OUTPUT
echo "idl-buffer=$(cat idl-buffer.out | sed 's/Idl buffer created: //g' | xargs echo -n)" >> $GITHUB_OUTPUT
- run: echo "buffer=${{ steps.buffer-deploy.outputs.buffer }}"
shell: bash
- run: echo "idl-buffer=${{ steps.buffer-deploy.outputs.idl-buffer }}"
shell: bash
- name: Transfer idl buffer to authority
uses: nick-invision/retry@v2
with:
timeout_minutes: 10
max_attempts: 10
shell: bash
command: anchor idl set-authority $IDL_BUFFER --provider.cluster $NETWORK --program-id $PROGRAM_ID --new-authority $AUTHORITY --provider.wallet ./deploy-keypair.json
env:
IDL_BUFFER: ${{ steps.buffer-deploy.outputs.idl-buffer }}
AUTHORITY: ${{ inputs.buffer-authority }}
NETWORK: ${{ inputs.network }}
PROGRAM_ID: ${{ inputs.program-id }}
- name: Transfer buffer to authority
uses: nick-invision/retry@v2
with:
timeout_minutes: 10
max_attempts: 10
shell: bash
command: solana program set-buffer-authority $BUFFER -k ./deploy-keypair.json --new-buffer-authority $AUTHORITY -u $NETWORK
env:
BUFFER: ${{ steps.buffer-deploy.outputs.buffer }}
AUTHORITY: ${{ inputs.buffer-authority }}
NETWORK: ${{ inputs.network }}
- run: rm ./deploy-keypair.json
shell: bash