forked from Traqora/Traqora
-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (89 loc) · 3.63 KB
/
Copy pathcd-mainnet.yml
File metadata and controls
102 lines (89 loc) · 3.63 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
91
92
93
94
95
96
97
98
99
100
101
102
name: CD - Mainnet
on:
workflow_dispatch:
inputs:
environment:
description: "Environment to deploy to"
required: true
default: "mainnet"
jobs:
deploy-approval:
name: Mainnet Deployment Approval
runs-on: ubuntu-latest
environment: mainnet
steps:
- name: Approve
run: echo "Deployment approved for mainnet"
deploy-contracts:
name: Deploy Contracts to Mainnet
needs: deploy-approval
runs-on: ubuntu-latest
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 Mainnet
env:
SOROBAN_SECRET_KEY: ${{ secrets.SOROBAN_MAINNET_SECRET_KEY }}
NETWORK: mainnet
RPC_URL: https://soroban-rpc.mainnet.stellar.org:443
NETWORK_PASSPHRASE: "Public Global Stellar Network ; October 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 "Mainnet Deployed Contract ID: $CONTRACT_ID"
deploy-frontend-backend:
name: Build and Deploy App to Mainnet
needs: [deploy-approval, deploy-contracts]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build and Deploy
run: echo "Deploying production 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 Mainnet successful!"
else
echo "Deployment to Mainnet failed."
exit 1
fi