-
Notifications
You must be signed in to change notification settings - Fork 4
97 lines (80 loc) · 2.35 KB
/
build.yml
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: build
on: [push]
jobs:
build:
if: ${{!startsWith(github.ref, 'refs/tags/')}}
strategy:
fail-fast: false
matrix:
os:
- os: ubuntu-20.04
build-name: llm-multitool
exe-name: llm-multitool-linux-amd64
- os: windows-latest
build-name: llm-multitool.exe
exe-name: llm-multitool-windows-amd64.exe
- os: macos-latest
build-name: llm-multitool
exe-name: llm-multitool-macos
runs-on: ${{ matrix.os.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21.1
- name: Prepare backend
run: |
cd backend
go install -v github.com/searKing/golang/tools/go-enum
- name: Prepare frontend
working-directory: frontend
run: npm install
- name: Build frontend
working-directory: frontend
run: npm run build
- name: Move frontend artifacts
run: cp -r ./frontend/dist ./backend/resources
- name: Build Backend
working-directory: backend
run: |
go generate -v -x ./...
go build .
- name: Test backend
working-directory: backend
run:
go test ./...
- name: Rename executable
run: mv backend/${{ matrix.os.build-name }} ${{ matrix.os.exe-name }}
- name: Keep the executable
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os.exe-name }}
path: ${{ matrix.os.exe-name }}
release-tag-as-draft:
name: Release tag as a draft release
runs-on: ubuntu-latest
needs: [build]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download Linux executable
uses: actions/download-artifact@v2
with:
name: llm-multitool-linux-amd64
- name: Download MacOS executable
uses: actions/download-artifact@v2
with:
name: llm-multitool-macos
- name: Download Windows executable
uses: actions/download-artifact@v2
with:
name: llm-multitool-windows.exe
- name: Create GH release
uses: softprops/action-gh-release@v1
with:
files: |
llm-multitool-linux-amd64
llm-multitool-macos
llm-multitool-windows-amd64.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}