-
Notifications
You must be signed in to change notification settings - Fork 17
58 lines (49 loc) · 1.35 KB
/
go.yaml
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
name: Go Build
on:
push:
branches:
- main # 触发构建的分支
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
# 检出代码
- name: Checkout code
uses: actions/checkout@v3
# 安装必要依赖
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y libasound2-dev pkg-config
# 设置 Go 环境
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.22.4 # 根据你的项目使用的 Go 版本调整
# 缓存 Go 依赖
- name: Cache Go modules
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
# 切换到项目目录并安装依赖
- name: Install dependencies
run: |
cd ./yatori-go/yatori-go-console
go mod tidy
# 构建项目
- name: Build project
run: |
cd ./yatori-go/yatori-go-console
go build -o yatori-go-console
# 上传二进制文件作为 Artifact
- name: Upload binary
uses: actions/upload-artifact@v3
with:
name: myapp-binary
path: ./yatori-go/yatori-go-console/yatori-go-console