-
Notifications
You must be signed in to change notification settings - Fork 1
134 lines (114 loc) · 3.78 KB
/
Copy pathdeploy.yml
File metadata and controls
134 lines (114 loc) · 3.78 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
133
134
name: Deploy
on:
workflow_dispatch:
inputs:
network:
description: "Target network"
required: true
default: "testnet"
type: choice
options:
- testnet
- mainnet
deploy-contracts:
description: "Deploy smart contracts"
required: true
default: true
type: boolean
deploy-backend:
description: "Deploy backend services"
required: true
default: true
type: boolean
deploy-frontend:
description: "Deploy frontend"
required: true
default: true
type: boolean
env:
NETWORK: ${{ github.event.inputs.network || 'testnet' }}
jobs:
test:
uses: ./.github/workflows/test-contracts.yml
secrets: inherit
deploy-contracts:
needs: [test]
if: ${{ github.event.inputs.deploy-contracts == 'true' || github.event.inputs.deploy-contracts == '' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Build contracts
run: cargo build --target wasm32-unknown-unknown --release
- name: Deploy contracts
run: |
chmod +x scripts/deploy.sh
./scripts/deploy.sh --network ${{ env.NETWORK }} --account factorchain-deployer
env:
SOROBAN_RPC_URL: ${{ secrets.SOROBAN_RPC_URL }}
STELLAR_NETWORK_PASSPHRASE: ${{ secrets.STELLAR_NETWORK_PASSPHRASE }}
- name: Initialize contracts
run: |
chmod +x scripts/initialize.sh
./scripts/initialize.sh --network ${{ env.NETWORK }}
env:
SOROBAN_RPC_URL: ${{ secrets.SOROBAN_RPC_URL }}
- name: Write deployed addresses to summary
run: |
echo "## Deployed Contracts (${{ env.NETWORK }})" >> $GITHUB_STEP_SUMMARY
cat .env | grep "_CONTRACT=" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
deploy-backend:
needs: [deploy-contracts]
if: ${{ github.event.inputs.deploy-backend == 'true' || github.event.inputs.deploy-backend == '' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
steps:
- uses: actions/checkout@v4
- name: Setup Node.js 20
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install dependencies
run: npm ci
- name: Build backend
run: npm run build
- name: Deploy backend (Railway)
run: |
echo "Backend build complete. Ready for Railway deployment."
echo "Run: railway up --service api"
echo "Run: railway up --service indexer"
echo "Run: railway up --service oracle"
echo "Run: railway up --service notifications"
env:
RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }}
deploy-frontend:
needs: [deploy-contracts]
if: ${{ github.event.inputs.deploy-frontend == 'true' || github.event.inputs.deploy-frontend == '' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v4
- name: Setup Node.js 20
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install dependencies
run: npm ci
- name: Build frontend
run: npm run build
env:
VITE_API_BASE_URL: ${{ secrets.VITE_API_BASE_URL }}
VITE_SOROBAN_RPC_URL: ${{ secrets.SOROBAN_RPC_URL }}
VITE_NETWORK_PASSPHRASE: ${{ secrets.STELLAR_NETWORK_PASSPHRASE }}
- name: Deploy frontend (Vercel)
run: npx vercel --prod --token=${{ secrets.VERCEL_TOKEN }} --yes