Skip to content

Commit 254f03c

Browse files
committed
t
1 parent c86b8c8 commit 254f03c

7 files changed

+257
-142
lines changed

.github/workflows/release.yml

+76-11
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,94 @@ permissions:
99
contents: write
1010

1111
jobs:
12-
release:
12+
build_fe:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Checkout
1616
uses: actions/checkout@v4
1717
with:
18-
fetch-depth: 0 # for goreleaser generating changelog
19-
- name: Set up Go
20-
uses: actions/setup-go@v5
21-
with:
22-
go-version: "1.22"
18+
fetch-depth: 0
2319
- name: Set up Node
2420
uses: actions/setup-node@v4
2521
with:
2622
node-version: 21
2723
- name: Build
24+
working-directory: frontend
2825
run: |
29-
./scripts.sh build
30-
- name: Run GoReleaser
26+
npm i && npm run build
27+
- name: Upload dist
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: fe_dist
31+
path: frontend/build
32+
retention-days: 1
33+
build_be:
34+
needs: build_fe
35+
strategy:
36+
matrix:
37+
os: [ubuntu-latest, macos-latest]
38+
runs-on: ${{ matrix.os }}
39+
steps:
40+
- name: Checkout
41+
uses: actions/checkout@v4
42+
- name: Download the dist of FE
43+
uses: actions/download-artifact@v4
44+
with:
45+
name: fe_dist
46+
path: frontend/build/
47+
- name: Set up Go
48+
uses: actions/setup-go@v5
49+
with:
50+
go-version: "1.22"
51+
- name: Build for Darwin
52+
if: ${{ startsWith(matrix.os, 'macos') }}
3153
uses: goreleaser/goreleaser-action@v5
3254
with:
33-
distribution: goreleaser
34-
version: latest
35-
args: release --clean
55+
args: release --skip=publish --clean --config .goreleaser.darwin.yaml
56+
- name: Prepare for Linux and Windows
57+
if: ${{ startsWith(matrix.os, 'ubuntu') }}
58+
run: |
59+
sudo apt-get install -y gcc-aarch64-linux-gnu gcc-mingw-w64
60+
- name: Build for Linux and Windows
61+
if: ${{ startsWith(matrix.os, 'ubuntu') }}
62+
uses: goreleaser/goreleaser-action@v5
63+
with:
64+
args: release --skip=publish --clean --config .goreleaser.linux.yaml
65+
- name: Upload dist
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: "be_${{ matrix.os }}_dist"
69+
path: |
70+
dist/*.zip
71+
dist/*_checksums.txt
72+
retention-days: 1
73+
publish:
74+
needs: [build_be]
75+
runs-on: ubuntu-latest
76+
steps:
77+
- name: Create dist dir
78+
run: |
79+
mkdir -p ./dist/
80+
- name: Download the dist of BE
81+
uses: actions/download-artifact@v4
82+
with:
83+
pattern: be_*_dist
84+
path: ./dist/
85+
merge-multiple: true
86+
- name: Merge checksums
87+
working-directory: ./dist
88+
run: |
89+
cat *_checksums.txt >> checksums.txt
90+
rm *_checksums.txt
91+
ls
92+
- name: Checkout
93+
uses: actions/checkout@v4
94+
with:
95+
fetch-depth: 0 # for goreleaser generating changelog
96+
- name: Publish release
3697
env:
3798
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99+
uses: goreleaser/goreleaser-action@v5
100+
with:
101+
distribution: goreleaser
102+
args: release --config .goreleaser.yaml

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
*.paw
44
tmp/
55
build/
6+
dist/

.goreleaser.darwin.yaml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
dist: ./dist
2+
builds:
3+
- binary: fusion
4+
main: ./cmd/server
5+
env:
6+
- CGO_ENABLED=1
7+
goos:
8+
- darwin
9+
goarch:
10+
- amd64
11+
- arm64
12+
13+
archives:
14+
- id: default
15+
format: zip
16+
17+
checksum:
18+
algorithm: sha256
19+
name_template: "darwin_checksums.txt"
20+
21+
snapshot:
22+
name_template: "{{ incpatch .Version }}-next"

.goreleaser.linux.yaml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
dist: ./dist
2+
builds:
3+
- binary: fusion
4+
main: ./cmd/server
5+
env:
6+
# gcc-aarch64-linux-gnu is required
7+
# gcc-mingw-w64 are required for windows
8+
- CGO_ENABLED=1
9+
goos:
10+
- linux
11+
- windows
12+
goarch:
13+
- amd64
14+
- arm64
15+
ignore:
16+
# TODO: gcc-mingw-w64 on linux-arm64 not includes aarch64-w64-mingw32-gcc
17+
- goos: windows
18+
goarch: arm64
19+
overrides:
20+
- goos: linux
21+
goarch: arm64
22+
env:
23+
- CC=aarch64-linux-gnu-gcc
24+
# - goos: windows
25+
# goarch: arm64
26+
# env:
27+
# - CC=aarch64-w64-mingw32-gcc
28+
# - CXX=aarch64-w64-mingw32-g++
29+
- goos: windows
30+
goarch: amd64
31+
goamd64: v1
32+
env:
33+
- CC=x86_64-w64-mingw32-gcc
34+
- CXX=x86_64-w64-mingw32-g++
35+
36+
archives:
37+
- id: default
38+
format: zip
39+
40+
checksum:
41+
algorithm: sha256
42+
name_template: "linux_checksums.txt"
43+
44+
snapshot:
45+
name_template: "{{ incpatch .Version }}-next"

.goreleaser.yaml

+5-26
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,14 @@
11
# project_name: fusion
2-
dist: ./build
32
builds:
4-
- env:
5-
- CGO_ENABLED=0
6-
goos:
7-
- linux
8-
- windows
9-
- darwin
10-
goarch:
11-
- amd64
12-
- "386"
13-
- arm64
14-
ignore:
15-
- goos: darwin
16-
goarch: "386"
17-
binary: fusion
18-
main: ./cmd/server
3+
- skip: true
194

20-
archives:
21-
- id: default
22-
format: zip
23-
24-
checksum:
25-
algorithm: sha256
26-
name_template: "checksums.txt"
27-
28-
snapshot:
29-
name_template: "{{ incpatch .Version }}-next"
5+
dist: ./dist
306

317
changelog:
328
use: github
339

3410
release:
3511
draft: true
12+
extra_files:
13+
- glob: ./dist/*.zip
14+
- glob: ./dist/checksums.txt

0 commit comments

Comments
 (0)