forked from AlistGo/alist
-
Notifications
You must be signed in to change notification settings - Fork 2
79 lines (69 loc) · 2.18 KB
/
Copy pathbuild.yml
File metadata and controls
79 lines (69 loc) · 2.18 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
73
74
75
76
77
78
79
name: build
on:
push:
branches: [ 'main' ]
pull_request:
branches: [ 'main' ]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
matrix:
platform: [ubuntu-latest]
target:
- darwin-amd64
- darwin-arm64
- windows-amd64
- linux-arm64-musl
- linux-amd64-musl
- windows-arm64
- android-arm64
- windows-win7-amd64
name: Build
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: benjlevesque/short-sha@v3.0
id: short-sha
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Go mod tidy
run: go mod tidy
- name: Setup web
run: bash build.sh dev web
- name: Install MinGW for Win7 build
if: matrix.target == 'windows-win7-amd64'
run: |
sudo apt-get update
sudo apt-get install -y gcc-mingw-w64-x86-64
- name: Build Win7 Binary
if: matrix.target == 'windows-win7-amd64'
run: |
bash build.sh release win7
mkdir -p build
- name: Set current date as version
id: date
run: echo "build_date=$(date +'%Y%m%d.%H%M%S')" >> $GITHUB_ENV
- name: Build
if: matrix.target != 'windows-win7-amd64'
uses: pongfcnkl/cgo-actions34@v1
with:
targets: ${{ matrix.target }}
musl-target-format: $os-$musl-$arch
out-dir: build
x-flags: |
github.com/alist-org/alist/v3/internal/conf.BuiltAt=$built_at
github.com/alist-org/alist/v3/internal/conf.GitAuthor=Xhofe
github.com/alist-org/alist/v3/internal/conf.GitCommit=$git_commit
github.com/alist-org/alist/v3/internal/conf.Version=${{ env.build_date }}
github.com/alist-org/alist/v3/internal/conf.WebVersion=dev
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: alist_${{ env.SHA }}_${{ matrix.target }}
path: build/*