forked from PinSpace-Org/GistPin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontract-deployment.yml
More file actions
90 lines (75 loc) 路 2.55 KB
/
Copy pathcontract-deployment.yml
File metadata and controls
90 lines (75 loc) 路 2.55 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: Contract Deployment & Verification
on:
push:
branches: [main, develop]
paths:
- 'contracts/**'
workflow_dispatch:
inputs:
network:
description: 'Stellar network to deploy to'
required: true
type: choice
options: [testnet, mainnet]
default: testnet
jobs:
build-and-test:
name: Build & Test Contracts
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
contracts/target
key: ${{ runner.os }}-cargo-${{ hashFiles('contracts/Cargo.lock') }}
- name: Build contracts
working-directory: contracts
run: cargo build --target wasm32-unknown-unknown --release
- name: Run contract tests
working-directory: contracts
run: cargo test
deploy:
name: Deploy to ${{ github.event.inputs.network || 'testnet' }}
runs-on: ubuntu-latest
needs: build-and-test
environment: ${{ github.event.inputs.network || 'testnet' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Install Stellar CLI
run: cargo install --locked stellar-cli
- name: Build contracts
working-directory: contracts
run: cargo build --target wasm32-unknown-unknown --release
- name: Deploy contract
id: deploy
run: bash infrastructure/ci/scripts/deploy-contract.sh
env:
STELLAR_NETWORK: ${{ github.event.inputs.network || 'testnet' }}
STELLAR_SECRET_KEY: ${{ secrets.STELLAR_SECRET_KEY }}
STELLAR_RPC_URL: ${{ secrets.STELLAR_RPC_URL }}
- name: Verify deployment
run: bash infrastructure/ci/contract-verification.sh
env:
STELLAR_NETWORK: ${{ github.event.inputs.network || 'testnet' }}
CONTRACT_ID: ${{ steps.deploy.outputs.contract_id }}
STELLAR_RPC_URL: ${{ secrets.STELLAR_RPC_URL }}
- name: Store contract IDs
uses: actions/upload-artifact@v4
with:
name: contract-ids-${{ github.event.inputs.network || 'testnet' }}-${{ github.sha }}
path: contract-ids.json
retention-days: 90