-
Notifications
You must be signed in to change notification settings - Fork 44
150 lines (129 loc) · 4.96 KB
/
Copy pathrelease.yml
File metadata and controls
150 lines (129 loc) · 4.96 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: Release
# ---------------------------------------------------------------------------
# Triggers
# ---------------------------------------------------------------------------
# Runs only when a version tag (v*.*.*) is pushed.
# Typical flow:
# git tag v1.2.0 && git push origin v1.2.0
on:
push:
tags:
- "v*.*.*"
# One release at a time — don't allow parallel release runs.
concurrency:
group: release
cancel-in-progress: false
# ---------------------------------------------------------------------------
# Jobs
# ---------------------------------------------------------------------------
jobs:
# -------------------------------------------------------------------------
# 1. Build all artefacts
# -------------------------------------------------------------------------
build:
name: Build artefacts
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
# ── Node / Server ────────────────────────────────────────────────────
- name: Set up Node.js 20
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: server/package-lock.json
- name: Install server dependencies
working-directory: server
run: npm ci
- name: Build server
working-directory: server
run: npm run build
# ── Frontend ─────────────────────────────────────────────────────────
- name: Install frontend dependencies
working-directory: frontend
run: npm ci
- name: Build frontend
working-directory: frontend
env:
NEXT_PUBLIC_API_URL: ${{ vars.NEXT_PUBLIC_API_URL }}
run: npm run build
# ── Rust / Soroban ───────────────────────────────────────────────────
- name: Set up Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32v1-none
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
contracts/target
key: cargo-release-${{ hashFiles('contracts/Cargo.lock') }}
- name: Build WASM (release)
working-directory: contracts
run: cargo build --release --target wasm32v1-none
# ── Package artefacts ─────────────────────────────────────────────────
- name: Package server dist
run: |
cd server
tar -czf ../airflex-server-${{ github.ref_name }}.tar.gz \
dist/ package.json package-lock.json
- name: Copy WASM
run: |
cp contracts/target/wasm32v1-none/release/airflex_escrow.wasm \
airflex-escrow-${{ github.ref_name }}.wasm
- name: Upload release artefacts
uses: actions/upload-artifact@v4
with:
name: release-artefacts
path: |
airflex-server-${{ github.ref_name }}.tar.gz
airflex-escrow-${{ github.ref_name }}.wasm
retention-days: 30
# -------------------------------------------------------------------------
# 2. Create GitHub Release
# -------------------------------------------------------------------------
github-release:
name: GitHub Release
runs-on: ubuntu-latest
needs: build
permissions:
contents: write # required to create releases and upload assets
steps:
- name: Checkout (for changelog)
uses: actions/checkout@v4
with:
fetch-depth: 0 # full history for git log
- name: Download artefacts
uses: actions/download-artifact@v4
with:
name: release-artefacts
# Build a changelog from commits since the previous tag
- name: Generate changelog
id: changelog
run: |
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
if [ -n "$PREV_TAG" ]; then
RANGE="$PREV_TAG..HEAD"
else
RANGE="HEAD"
fi
{
echo "## What's changed"
echo ""
git log $RANGE --pretty="- %s (%h)" --no-merges
} > CHANGELOG.md
cat CHANGELOG.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: AirFlex ${{ github.ref_name }}
body_path: CHANGELOG.md
files: |
airflex-server-${{ github.ref_name }}.tar.gz
airflex-escrow-${{ github.ref_name }}.wasm
draft: false
prerelease: ${{ contains(github.ref_name, '-') }}