-
-
Notifications
You must be signed in to change notification settings - Fork 31
175 lines (144 loc) · 5.08 KB
/
release.yml
File metadata and controls
175 lines (144 loc) · 5.08 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
name: Publish to npm
permissions:
contents: write
id-token: write
on:
release:
types: [created]
workflow_dispatch:
jobs:
build-client:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
- name: Build client
run: bun install && bun run build:client
- name: Upload client dist
uses: actions/upload-artifact@v6
with:
name: client-dist
path: client/dist/
build-linux:
needs: build-client
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Download client dist
uses: actions/download-artifact@v8
with:
name: client-dist
path: client/dist/
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-gnu
- name: Build server binary
run: cargo build --release --bin server --target x86_64-unknown-linux-gnu
- name: Upload artifact
uses: actions/upload-artifact@v6
with:
name: bin-linux
path: target/x86_64-unknown-linux-gnu/release/server
build-linux-arm64:
needs: build-client
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Download client dist
uses: actions/download-artifact@v8
with:
name: client-dist
path: client/dist/
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-unknown-linux-gnu
- name: Install cross-compilation toolchain
run: sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Build server binary
run: cargo build --release --bin server --target aarch64-unknown-linux-gnu
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
- name: Upload artifact
uses: actions/upload-artifact@v6
with:
name: bin-linux-arm64
path: target/aarch64-unknown-linux-gnu/release/server
build-mac:
needs: build-client
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Download client dist
uses: actions/download-artifact@v8
with:
name: client-dist
path: client/dist/
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin,x86_64-apple-darwin
- name: Build server binary (arm64)
run: cargo build --release --bin server --target aarch64-apple-darwin
- name: Build server binary (x86_64)
run: cargo build --release --bin server --target x86_64-apple-darwin
- name: Upload artifacts
uses: actions/upload-artifact@v6
with:
name: bin-mac
path: |
target/aarch64-apple-darwin/release/server
target/x86_64-apple-darwin/release/server
publish:
needs: [build-linux, build-linux-arm64, build-mac]
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Download Linux binary
uses: actions/download-artifact@v8
with:
name: bin-linux
path: bin-linux/
- name: Download Linux arm64 binary
uses: actions/download-artifact@v8
with:
name: bin-linux-arm64
path: bin-linux-arm64/
- name: Download Mac binaries
uses: actions/download-artifact@v8
with:
name: bin-mac
path: bin-mac/
- name: Stage binaries
run: |
mkdir -p bin
cp bin-linux/server bin/freecodecamp-server-x86_64-unknown-linux-gnu
cp bin-linux-arm64/server bin/freecodecamp-server-aarch64-unknown-linux-gnu
cp bin-mac/aarch64-apple-darwin/release/server bin/freecodecamp-server-aarch64-apple-darwin
cp bin-mac/x86_64-apple-darwin/release/server bin/freecodecamp-server-x86_64-apple-darwin
chmod +x bin/freecodecamp-server-*
- name: Upload binaries to release
if: github.event_name == 'release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload "${{ github.ref_name }}" \
bin/freecodecamp-server-x86_64-unknown-linux-gnu \
bin/freecodecamp-server-aarch64-unknown-linux-gnu \
bin/freecodecamp-server-aarch64-apple-darwin \
bin/freecodecamp-server-x86_64-apple-darwin \
--clobber
- name: Set up Node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: 24
registry-url: 'https://registry.npmjs.org'
- name: Publish to npm
run: npm publish --access public