forked from Traqora/Traqora
-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (78 loc) · 3.2 KB
/
Copy pathcd-testnet.yml
File metadata and controls
90 lines (78 loc) · 3.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
85
86
87
88
89
90
name: CD - Testnet
on:
push:
branches: [main]
jobs:
deploy-contracts:
name: Deploy Contracts to Testnet
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.94.1
targets: wasm32-unknown-unknown
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
contracts/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('contracts/Cargo.lock') }}
- name: Install Soroban CLI
run: |
cargo install --locked --version 26.1.0 soroban-cli
- name: Build Contracts
run: |
cd contracts
cargo build --locked --target wasm32-unknown-unknown --release
- name: Upload Contract Artifacts
uses: actions/upload-artifact@v4
with:
name: traqora-contracts-wasm
path: contracts/target/wasm32-unknown-unknown/release/*.wasm
- name: Deploy to Testnet
env:
SOROBAN_SECRET_KEY: ${{ secrets.SOROBAN_SECRET_KEY }}
NETWORK: testnet
RPC_URL: https://soroban-testnet.stellar.org:443
NETWORK_PASSPHRASE: "Test SDF Network ; September 2015"
run: |
soroban network add --rpc-url $RPC_URL --network-passphrase "$NETWORK_PASSPHRASE" $NETWORK
echo "$SOROBAN_SECRET_KEY" > secret.txt
soroban config identity add --secret-key deployer < secret.txt
rm secret.txt
# Deploy all contracts or specific ones as needed
# Here we deploy the booking contract as an example
CONTRACT_ID=$(soroban contract deploy \
--wasm contracts/target/wasm32-unknown-unknown/release/booking.wasm \
--source deployer \
--network $NETWORK)
echo "Deployed Contract ID: $CONTRACT_ID"
deploy-frontend-backend:
name: Build and Deploy App
needs: deploy-contracts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build and Deploy
run: echo "Deploying app components..."
notify:
name: Notification
needs: [deploy-contracts, deploy-frontend-backend]
if: always()
runs-on: ubuntu-latest
steps:
- name: Notify Success/Failure
run: |
if [ "${{ needs.deploy-contracts.result }}" == "success" ] && [ "${{ needs.deploy-frontend-backend.result }}" == "success" ]; then
echo "Deployment to Testnet successful!"
else
echo "Deployment to Testnet failed."
exit 1
fi