-
-
Notifications
You must be signed in to change notification settings - Fork 74
109 lines (93 loc) · 4.12 KB
/
release-program.yaml
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
name: Program+IDL Upgrade MS Proposal
on:
push:
tags:
- "testest-program-*"
env:
RUST_TOOLCHAIN: 1.75.0
SOLANA_CLI_VERSION: 1.18.17
ANCHOR_CLI_VERSION: 0.30.1
ANCHOR_SHA: e6d7dafe12da661a36ad1b4f3b5970e8986e5321
CARGO_TERM_COLOR: always
jobs:
build-verifiable:
name: Generate verifiable build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install common dependencies
uses: ./.github/actions/setup-common/
- name: Install Anchor CLI
uses: ./.github/actions/setup-anchor-cli/
- name: Extract tag information
run: |
TAG=${GITHUB_REF#refs/tags/} # Extract tag name from ref
echo "Tag name: $TAG"
PROGRAM=$(echo $TAG | sed 's/testest-program-\(.*\)-[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/\1/')
VERSION=$(echo $TAG | sed 's/.*-\([0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\)$/\1/')
PROGRAM_LIB_NAME=${PROGRAM//-/_} # Substitute dashes with underscores
PROGRAM_ID=$(~/.cargo/bin/toml get Anchor.toml programs.mainnet.${PROGRAM_LIB_NAME} | tr -d '"')
echo "Program: $PROGRAM"
echo "Program ID: $PROGRAM_ID"
echo "Version: $VERSION"
echo "PROGRAM_ID=${PROGRAM_ID}" >> $GITHUB_ENV
echo "PROGRAM_LIB_NAME=${PROGRAM_LIB_NAME}" >> $GITHUB_ENV
# Solely to generate the IDL
- name: Build program using Anchor
uses: ./.github/actions/build-program/
with:
program_lib_name: ${{ env.PROGRAM_LIB_NAME }}
# Build verifiable program - store it in target/deploy/${PROGRAM_LIB_NAME}.so
- name: Build verifiable program
uses: ./.github/actions/build-verifiable-program/
with:
program_lib_name: ${{ env.PROGRAM_LIB_NAME }}
- name: Patch IDL and TS files
run: |
cargo run \
--release \
--package marginfi-v2-cli \
--features dev \
-- patch-idl target/idl/${{ env.PROGRAM_LIB_NAME }}.json
rm target/idl/${{ env.PROGRAM_LIB_NAME }}.json
mv target/idl/${{ env.PROGRAM_LIB_NAME }}_patched.json target/idl/${{ env.PROGRAM_LIB_NAME }}.json
# Display contents of /target/deploy and /target/idl
- run: ls -l target/deploy
- run: ls -l target/idl
- name: Upload program and IDL to buffers
uses: ./.github/actions/deploy-buffers/
id: deploy-buffers
with:
program-lib-name: ${{ env.PROGRAM_LIB_NAME }}
program-id: ${{ env.PROGRAM_ID }}
deployer-keypair: ${{ secrets.DEPLOYER_KEYPAIR }}
buffer-authority: ${{ secrets.MULTISIG_VAULT }}
rpc-endpoint: ${{ secrets.RPC_ENDPOINT }}
# # Create MS proposal for program upgrade
# - name: Squads program upgrade
# uses: mrgnlabs/squads-program-upgrade@v0.3.1
# with:
# network-url: "https://api.mainnet-beta.solana.com"
# program-multisig: ${{ secrets.MULTISIG }}
# program-id: ${{ env.PROGRAM_ID }}
# buffer: ${{ steps.deploy-buffers.outputs.program-buffer }}
# idl-buffer: ${{ steps.deploy-buffers.outputs.idl-buffer }}
# spill-address: ${{ secrets.DEPLOYER_ADDRESS }}
# authority: ${{ secrets.MULTISIG_VAULT }}
# name: "Deploy ${{env.PROGRAM_LIB_NAME}} ${{env.VERSION}}"
# keypair: ${{ secrets.DEPLOYER_KEYPAIR }}
# - name: Upload program
# uses: actions/upload-artifact@v2
# with:
# name: ${{ env.PROGRAM_LIB_NAME }}-verifiable_build-${{ github.run_id }}-${{ github.run_attempt }}
# path: ./target/deploy/${{ env.PROGRAM_LIB_NAME }}.so
# - name: Upload IDL (json)
# uses: actions/upload-artifact@v2
# with:
# name: ${{ env.PROGRAM_LIB_NAME }}-idl-${{ github.run_id }}-${{ github.run_attempt }}
# path: ./target/idl/${{ env.PROGRAM_LIB_NAME }}_patched.json
# - name: Upload IDL (types)
# uses: actions/upload-artifact@v2
# with:
# name: ${{ env.PROGRAM_LIB_NAME }}-types-${{ github.run_id }}-${{ github.run_attempt }}
# path: ./target/idl/${{ env.PROGRAM_LIB_NAME }}_patched.ts