Skip to content

Commit eb0443c

Browse files
chore(.github): fix build order
1 parent 0bec55a commit eb0443c

1 file changed

Lines changed: 50 additions & 24 deletions

File tree

.github/workflows/release.yml

Lines changed: 50 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,37 @@ on:
99
workflow_dispatch:
1010

1111
jobs:
12+
build-client:
13+
runs-on: ubuntu-24.04
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
17+
18+
- name: Set up Bun
19+
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
20+
21+
- name: Build client
22+
run: bun install && bun run build:client
23+
24+
- name: Upload client dist
25+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
26+
with:
27+
name: client-dist
28+
path: client/dist/
29+
1230
build-linux:
31+
needs: build-client
1332
runs-on: ubuntu-24.04
1433
steps:
1534
- name: Checkout
1635
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1736

37+
- name: Download client dist
38+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
39+
with:
40+
name: client-dist
41+
path: client/dist/
42+
1843
- name: Set up Rust
1944
uses: dtolnay/rust-toolchain@stable
2045
with:
@@ -23,23 +48,25 @@ jobs:
2348
- name: Build server binary
2449
run: cargo build --release --bin server --target x86_64-unknown-linux-gnu
2550

26-
- name: Stage binary
27-
run: |
28-
mkdir -p bin
29-
cp target/x86_64-unknown-linux-gnu/release/server bin/freecodecamp-server-x86_64-unknown-linux-gnu
30-
3151
- name: Upload artifact
3252
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
3353
with:
3454
name: bin-linux
35-
path: bin/freecodecamp-server-x86_64-unknown-linux-gnu
55+
path: target/x86_64-unknown-linux-gnu/release/server
3656

3757
build-mac:
58+
needs: build-client
3859
runs-on: macos-14
3960
steps:
4061
- name: Checkout
4162
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4263

64+
- name: Download client dist
65+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
66+
with:
67+
name: client-dist
68+
path: client/dist/
69+
4370
- name: Set up Rust
4471
uses: dtolnay/rust-toolchain@stable
4572
with:
@@ -51,19 +78,13 @@ jobs:
5178
- name: Build server binary (x86_64)
5279
run: cargo build --release --bin server --target x86_64-apple-darwin
5380

54-
- name: Stage binaries
55-
run: |
56-
mkdir -p bin
57-
cp target/aarch64-apple-darwin/release/server bin/freecodecamp-server-aarch64-apple-darwin
58-
cp target/x86_64-apple-darwin/release/server bin/freecodecamp-server-x86_64-apple-darwin
59-
6081
- name: Upload artifacts
6182
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
6283
with:
6384
name: bin-mac
6485
path: |
65-
bin/freecodecamp-server-aarch64-apple-darwin
66-
bin/freecodecamp-server-x86_64-apple-darwin
86+
target/aarch64-apple-darwin/release/server
87+
target/x86_64-apple-darwin/release/server
6788
6889
publish:
6990
needs: [build-linux, build-mac]
@@ -72,20 +93,25 @@ jobs:
7293
- name: Checkout
7394
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
7495

75-
- name: Set up Bun
76-
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
77-
78-
- name: Build client
79-
run: bun install && bun run build:client
96+
- name: Download Linux binary
97+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
98+
with:
99+
name: bin-linux
100+
path: bin-linux/
80101

81-
- name: Download binaries
102+
- name: Download Mac binaries
82103
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
83104
with:
84-
merge-multiple: true
85-
path: bin/
105+
name: bin-mac
106+
path: bin-mac/
86107

87-
- name: Mark binaries executable
88-
run: chmod +x bin/freecodecamp-server-*
108+
- name: Stage binaries
109+
run: |
110+
mkdir -p bin
111+
cp bin-linux/server bin/freecodecamp-server-x86_64-unknown-linux-gnu
112+
cp bin-mac/aarch64-apple-darwin/release/server bin/freecodecamp-server-aarch64-apple-darwin
113+
cp bin-mac/x86_64-apple-darwin/release/server bin/freecodecamp-server-x86_64-apple-darwin
114+
chmod +x bin/freecodecamp-server-*
89115
90116
- name: Upload binaries to release
91117
if: github.event_name == 'release'

0 commit comments

Comments
 (0)