-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.yaml
More file actions
84 lines (65 loc) · 2.2 KB
/
deploy.yaml
File metadata and controls
84 lines (65 loc) · 2.2 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
name: Deploy Cryptonaut Vaults
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: rustfmt, clippy
- name: Install Solana CLI
run: |
sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
- name: Install Anchor
run: cargo install --git https://github.com/coral-xyz/anchor anchor-cli --locked
- name: Setup Solana environment
run: |
mkdir -p ~/.config/solana
echo "${{ secrets.SOLANA_KEYPAIR }}" > ~/.config/solana/id.json
echo "RPC_URL=${{ secrets.RPC_URL }}" >> $GITHUB_ENV
echo "SOLANA_CLUSTER=${{ secrets.SOLANA_CLUSTER }}" >> $GITHUB_ENV
echo "WALLET_KEYPAIR=~/.config/solana/id.json" >> $GITHUB_ENV
- name: Ensure deploy.sh exists
run: |
if [ ! -f deploy.sh ]; then
echo "🚀 Creating deploy.sh"
cat << 'EOF' > deploy.sh
#!/bin/bash
set -e
echo "🚀 Starting deployment..."
# Use GitHub Actions environment variables instead of .env
if [ -z "$RPC_URL" ] || [ -z "$SOLANA_CLUSTER" ] || [ -z "$WALLET_KEYPAIR" ]; then
echo "❌ Missing RPC_URL, SOLANA_CLUSTER, or WALLET_KEYPAIR environment variables."
exit 1
fi
solana config set --url $RPC_URL
solana config set --keypair $WALLET_KEYPAIR
echo "🔨 Building Anchor program..."
anchor build
echo "📦 Deploying program..."
anchor deploy --provider.cluster $SOLANA_CLUSTER
PROGRAM_ID=$(solana address -k target/deploy/*.json)
echo "✅ Program deployed with ID: $PROGRAM_ID"
echo "🔑 Generating PDAs for 9 vaults..."
node scripts/generate_pdas.js $PROGRAM_ID
echo "🌌 Deployment complete!"
EOF
fi
- name: Make deploy.sh executable
run: chmod +x deploy.sh
- name: Run Deployment
run: ./deploy.sh