-
Notifications
You must be signed in to change notification settings - Fork 12
73 lines (63 loc) · 1.72 KB
/
test.yml
File metadata and controls
73 lines (63 loc) · 1.72 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
name: Release
on:
push:
branches:
- '*'
workflow_dispatch:
jobs:
build:
name: Build and Release
runs-on: ubuntu-latest
strategy:
matrix:
# Define the target platforms
include:
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64
- goos: linux
goarch: arm
goarm: 7
- goos: darwin
goarch: amd64
- goos: darwin
goarch: arm64
- goos: windows
goarch: amd64
suffix: .exe
- goos: windows
goarch: arm64
suffix: .exe
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Build frontend
working-directory: ./front
run: |
npm install
npm run build
- name: Build backend
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
GOARM: ${{ matrix.goarm }}
run: |
CGO_ENABLED=0 go build -o tiny-nav${{ matrix.suffix }}
- name: Package artifacts
run: |
mkdir -p release
# 只打包可执行文件
if [[ "${{ matrix.goos }}" == "windows" ]]; then
zip -j release/tiny-nav-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goarm }}.zip tiny-nav${{ matrix.suffix }}
else
tar -czf release/tiny-nav-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goarm }}.tar.gz tiny-nav${{ matrix.suffix }}
fi