forked from MetaCubeX/mihomo
-
Notifications
You must be signed in to change notification settings - Fork 1
71 lines (63 loc) · 2.33 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
name: Build
on:
workflow_dispatch:
push:
paths-ignore:
- "docs/**"
- "README.md"
- ".github/ISSUE_TEMPLATE/**"
branches:
- Alpha
tags:
- "v*"
pull_request_target:
branches:
- Alpha
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
jobs:
- { goos: darwin, goarch: arm64, goamd64: v1, output: arm64 }
- { goos: darwin, goarch: amd64, goamd64: v1, output: amd64 }
- { goos: linux, goarch: '386', goamd64: v1, output: '386' }
- { goos: linux, goarch: amd64, goamd64: v1, output: x86_64 }
- { goos: linux, goarch: amd64, goamd64: v3, output: x86_64_v3 }
- { goos: linux, goarch: arm64, goamd64: v1, output: arm64 }
- { goos: windows, goarch: '386', goamd64: v1, output: '386' }
- { goos: windows, goarch: arm64, goamd64: v1, output: arm64 }
- { goos: windows, goarch: amd64, goamd64: v1, output: x86_64 }
- { goos: windows, goarch: amd64, goamd64: v3, output: x86_64_v3 }
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ^1.22
- name: Set Time Variable
run: |
echo "VERSION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "BUILDTIME=$(date)" >> $GITHUB_ENV
- name: build core
env:
GOOS: ${{matrix.jobs.goos}}
GOARCH: ${{matrix.jobs.goarch}}
GOAMD64: ${{matrix.jobs.goamd64}}
output: ${{matrix.jobs.output}}
CGO_ENABLED: '0'
run: |
go build -v -tags "with_gvisor" -trimpath -ldflags "-X 'github.com/metacubex/mihomo/constant.Version=${VERSION}' -X 'github.com/metacubex/mihomo/constant.BuildTime=${BUILDTIME}' -w -s -buildid="
if [ "${GOOS}" = "windows" ]; then
mv mihomo.exe mihomo-${GOOS}-${output}-${VERSION}.exe && zip -r mihomo-${GOOS}-${output}-${VERSION}.zip mihomo-${GOOS}-${output}-${VERSION}.exe
else
mv mihomo* mihomo-${GOOS}-${output}-${VERSION} && tar -czvf mihomo-${GOOS}-${output}-${VERSION}.tar.gz mihomo-${GOOS}-${output}-${VERSION}
fi
ls
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.jobs.goos }}-${{ matrix.jobs.goarch }}
path: |
mihomo*.tar.gz
mihomo*.zip