-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (47 loc) · 1.65 KB
/
go.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
name: Go
on:
push:
paths-ignore:
- README.md
- LICENSE
jobs:
build:
permissions:
id-token: write
contents: read
attestations: write
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Build
run: |
GOOS=linux GOARCH=amd64 go build -o build/linux-amd64/sbgraph main.go
GOOS=linux GOARCH=arm64 go build -o build/linux-arm64/sbgraph main.go
GOOS=windows GOARCH=amd64 go build -o build/windows/sbgraph.exe main.go
GOOS=darwin GOARCH=amd64 go build -o build/macos-amd64/sbgraph main.go
GOOS=darwin GOARCH=arm64 go build -o build/macos-arm64/sbgraph main.go
- name: Archive
if: startsWith(github.ref, 'refs/tags/')
run: |
(cd build/linux-amd64 && tar cfvz ../sbgraph-linux-amd64.tar.gz sbgraph)
(cd build/linux-arm64 && tar cfvz ../sbgraph-linux-arm64.tar.gz sbgraph)
(cd build/windows && tar cfvz ../sbgraph-windows-amd64.tar.gz sbgraph.exe)
(cd build/macos-amd64 && tar cfvz ../sbgraph-darwin-amd64.tar.gz sbgraph)
(cd build/macos-arm64 && tar cfvz ../sbgraph-darwin-arm64.tar.gz sbgraph)
- name: Generate artifact attestations
if: startsWith(github.ref, 'refs/tags/')
uses: actions/attest-build-provenance@v1
with:
subject-path: 'build/*.tar.gz'
- name: Publish
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: build/*.tar.gz