-
Notifications
You must be signed in to change notification settings - Fork 672
98 lines (88 loc) · 2.45 KB
/
Copy pathbuild.yml
File metadata and controls
98 lines (88 loc) · 2.45 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Build and Release
on:
workflow_dispatch:
push:
paths:
- 'VERSION'
permissions:
contents: write
jobs:
version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
tag: ${{ steps.version.outputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Read version
id: version
shell: bash
run: |
version="$(tr -d '[:space:]' < VERSION)"
echo "version=${version}" >> "${GITHUB_OUTPUT}"
echo "tag=v${version}" >> "${GITHUB_OUTPUT}"
build:
needs: version
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- goos: linux
goarch: amd64
- goos: linux
goarch: arm64
- goos: windows
goarch: amd64
- goos: darwin
goarch: amd64
- goos: freebsd
goarch: amd64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Build binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
VERSION: ${{ needs.version.outputs.version }}
shell: bash
run: |
artifact="aurora-${VERSION}-${GOOS}-${GOARCH}"
mkdir -p "${artifact}"
output="aurora"
if [ "${GOOS}" = "windows" ]; then
output="aurora.exe"
fi
go build -trimpath -ldflags="-s -w" -o "${artifact}/${output}" .
tar -czf "${artifact}.tar.gz" "${artifact}"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: aurora-${{ needs.version.outputs.version }}-${{ matrix.goos }}-${{ matrix.goarch }}
path: aurora-${{ needs.version.outputs.version }}-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz
if-no-files-found: error
release:
needs:
- version
- build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Create release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.version.outputs.tag }}
name: ${{ needs.version.outputs.tag }}
files: dist/*.tar.gz