Skip to content

Commit 8b914e6

Browse files
deploy.yaml
1 parent 798e2ac commit 8b914e6

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

β€Ždeploy.yamlβ€Ž

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Deploy Cryptonaut Vaults
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
deploy:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Node.js
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: 20
21+
22+
- name: Install Rust
23+
uses: actions-rs/toolchain@v1
24+
with:
25+
toolchain: stable
26+
profile: minimal
27+
components: rustfmt, clippy
28+
29+
- name: Install Solana CLI
30+
run: |
31+
sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
32+
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
33+
34+
- name: Install Anchor
35+
run: cargo install --git https://github.com/coral-xyz/anchor anchor-cli --locked
36+
37+
- name: Setup Solana environment
38+
run: |
39+
mkdir -p ~/.config/solana
40+
echo "${{ secrets.SOLANA_KEYPAIR }}" > ~/.config/solana/id.json
41+
echo "RPC_URL=${{ secrets.RPC_URL }}" >> $GITHUB_ENV
42+
echo "SOLANA_CLUSTER=${{ secrets.SOLANA_CLUSTER }}" >> $GITHUB_ENV
43+
echo "WALLET_KEYPAIR=~/.config/solana/id.json" >> $GITHUB_ENV
44+
45+
- name: Ensure deploy.sh exists
46+
run: |
47+
if [ ! -f deploy.sh ]; then
48+
echo "πŸš€ Creating deploy.sh"
49+
cat << 'EOF' > deploy.sh
50+
#!/bin/bash
51+
set -e
52+
53+
echo "πŸš€ Starting deployment..."
54+
55+
# Use GitHub Actions environment variables instead of .env
56+
if [ -z "$RPC_URL" ] || [ -z "$SOLANA_CLUSTER" ] || [ -z "$WALLET_KEYPAIR" ]; then
57+
echo "❌ Missing RPC_URL, SOLANA_CLUSTER, or WALLET_KEYPAIR environment variables."
58+
exit 1
59+
fi
60+
61+
solana config set --url $RPC_URL
62+
solana config set --keypair $WALLET_KEYPAIR
63+
64+
echo "πŸ”¨ Building Anchor program..."
65+
anchor build
66+
67+
echo "πŸ“¦ Deploying program..."
68+
anchor deploy --provider.cluster $SOLANA_CLUSTER
69+
70+
PROGRAM_ID=$(solana address -k target/deploy/*.json)
71+
echo "βœ… Program deployed with ID: $PROGRAM_ID"
72+
73+
echo "πŸ”‘ Generating PDAs for 9 vaults..."
74+
node scripts/generate_pdas.js $PROGRAM_ID
75+
76+
echo "🌌 Deployment complete!"
77+
EOF
78+
fi
79+
80+
- name: Make deploy.sh executable
81+
run: chmod +x deploy.sh
82+
83+
- name: Run Deployment
84+
run: ./deploy.sh

0 commit comments

Comments
Β (0)