-
Notifications
You must be signed in to change notification settings - Fork 18
75 lines (65 loc) · 1.95 KB
/
build-os-binary.yml
File metadata and controls
75 lines (65 loc) · 1.95 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
name: Build Multi-platform Binaries
on:
push:
tags: [ 'v*.*.*' ]
permissions:
contents: write
jobs:
build:
name: Build for ${{ matrix.os }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- os: linux
arch: amd64
goos: linux
goarch: amd64
suffix: ''
- os: windows
arch: amd64
goos: windows
goarch: amd64
suffix: '.exe'
- os: macos
arch: amd64
goos: darwin
goarch: amd64
suffix: ''
- os: macos
arch: arm64
goos: darwin
goarch: arm64
suffix: ''
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '^1.25'
cache: true
- name: Download dependencies
run: go mod tidy
- name: Build binary
run: |
CGO_ENABLED=0 GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} \
go build -ldflags="-s -w -X main.version=${{ github.ref_name }}" \
-o asmroner-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.suffix }}
- name: Create release assets
run: |
mkdir -p release
cp asmroner-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.suffix }} release/
cd release
if [ "${{ matrix.os }}" = "windows" ]; then
7z a ../asmroner-${{ matrix.os }}-${{ matrix.arch }}-${{ github.ref_name }}.zip *
else
zip -r ../asmroner-${{ matrix.os }}-${{ matrix.arch }}-${{ github.ref_name }}.zip *
fi
- name: Upload release asset
uses: softprops/action-gh-release@v1
with:
files: asmroner-${{ matrix.os }}-${{ matrix.arch }}-${{ github.ref_name }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}