Skip to content

Commit f4b0322

Browse files
committed
t
1 parent c86b8c8 commit f4b0322

8 files changed

+280
-144
lines changed

.github/workflows/release.yml

+80-11
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,98 @@ 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
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: Build for Windows
66+
if: ${{ startsWith(matrix.os, 'ubuntu') }}
67+
uses: goreleaser/goreleaser-action@v5
68+
with:
69+
args: release --skip=publish --clean --config .goreleaser.windows.yaml
70+
- name: Upload dist
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: "be_${{ matrix.os }}_dist"
74+
path: |
75+
dist/*.zip
76+
dist/*_checksums.txt
77+
retention-days: 1
78+
publish:
79+
needs: [build_be]
80+
runs-on: ubuntu-latest
81+
steps:
82+
- name: Create dist dir
83+
run: |
84+
mkdir -p ./dist/
85+
- name: Download the dist of BE
86+
uses: actions/download-artifact@v4
87+
with:
88+
pattern: be_*_dist
89+
path: ./dist/
90+
merge-multiple: true
91+
- name: Merge checksums
92+
working-directory: ./dist
93+
run: |
94+
cat *_checksums.txt >> checksums.txt
95+
rm *_checksums.txt
96+
- name: Checkout
97+
uses: actions/checkout@v4
98+
with:
99+
fetch-depth: 0 # for goreleaser generating changelog
100+
- name: Publish release
36101
env:
37102
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103+
uses: goreleaser/goreleaser-action@v5
104+
with:
105+
distribution: goreleaser
106+
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

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
dist: ./dist
2+
builds:
3+
- binary: fusion
4+
main: ./cmd/server
5+
env:
6+
# gcc-aarch64-linux-gnu is required
7+
- CGO_ENABLED=1
8+
goos:
9+
- linux
10+
goarch:
11+
- amd64
12+
- arm64
13+
overrides:
14+
- goos: linux
15+
goarch: arm64
16+
env:
17+
- CC=aarch64-linux-gnu-gcc
18+
19+
archives:
20+
- id: default
21+
format: zip
22+
23+
checksum:
24+
algorithm: sha256
25+
name_template: "linux_checksums.txt"
26+
27+
snapshot:
28+
name_template: "{{ incpatch .Version }}-next"

.goreleaser.windows.yaml

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

.goreleaser.yaml

+5-28
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,12 @@
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
19-
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"
30-
3+
- skip: true
4+
dist: ./dist
315
changelog:
326
use: github
337

348
release:
359
draft: true
10+
extra_files:
11+
- glob: ./dist/*.zip
12+
- glob: ./dist/checksums.txt

0 commit comments

Comments
 (0)