-
Notifications
You must be signed in to change notification settings - Fork 35
132 lines (112 loc) · 3.83 KB
/
deploy.yml
File metadata and controls
132 lines (112 loc) · 3.83 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Deploy to Testnet
on:
push:
branches: [ main, master ]
paths:
- 'smartcontract/**'
workflow_dispatch:
inputs:
environment:
description: 'Deployment environment'
required: true
default: 'testnet'
type: choice
options:
- testnet
- futurenet
env:
CARGO_TERM_COLOR: always
STELLAR_NETWORK: testnet
jobs:
build-contract:
name: Build Smart Contract
runs-on: ubuntu-latest
outputs:
wasm-path: ${{ steps.build.outputs.wasm-path }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install wasm32 target
run: rustup target add wasm32-unknown-unknown
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
smartcontract/target
key: ${{ runner.os }}-cargo-deploy-${{ hashFiles('**/Cargo.lock') }}
- name: Build contract
id: build
run: |
cd smartcontract
cargo build --target wasm32-unknown-unknown --release
echo "wasm-path=target/wasm32-unknown-unknown/release/chainbridge.wasm" >> $GITHUB_OUTPUT
- name: Upload WASM
uses: actions/upload-artifact@v3
with:
name: chainbridge-wasm
path: smartcontract/target/wasm32-unknown-unknown/release/chainbridge.wasm
retention-days: 30
deploy-contract:
name: Deploy Smart Contract
runs-on: ubuntu-latest
needs: build-contract
if: github.event_name == 'workflow_dispatch'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download WASM
uses: actions/download-artifact@v3
with:
name: chainbridge-wasm
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install Soroban CLI
run: cargo install soroban-cli --locked
- name: Configure Soroban network
run: |
soroban config network add --global testnet \
--rpc-url https://soroban-testnet.stellar.org:443 \
--network-passphrase "Test SDF Future Network ; October 2024"
- name: Deploy contract
env:
SOROBAN_SECRET_KEY: ${{ secrets.STELLAR_SECRET_KEY }}
run: |
echo "Note: Deployment requires STELLAR_SECRET_KEY secret"
echo "Contract would be deployed to ${{ github.event.inputs.environment || 'testnet' }}"
echo "WASM file: chainbridge.wasm"
echo ""
echo "Deployment command (manual):"
echo " soroban contract deploy \\"
echo " --wasm chainbridge.wasm \\"
echo " --network testnet \\"
echo " --source <identity>"
- name: Create deployment summary
run: |
echo "## Deployment Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Environment**: ${{ github.event.inputs.environment || 'testnet' }}" >> $GITHUB_STEP_SUMMARY
echo "**Contract**: chainbridge.wasm" >> $GITHUB_STEP_SUMMARY
echo "**Status**: Ready for manual deployment" >> $GITHUB_STEP_SUMMARY
notify-deployment:
name: Notify Deployment Status
runs-on: ubuntu-latest
needs: [build-contract, deploy-contract]
if: always()
steps:
- name: Create status summary
run: |
echo "## Build Status" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "✅ Smart contract built successfully" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "WASM artifact has been uploaded and is ready for deployment." >> $GITHUB_STEP_SUMMARY