-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (79 loc) · 2.58 KB
/
Copy pathrelease.yml
File metadata and controls
88 lines (79 loc) · 2.58 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
name: Release
on:
push:
tags: ["v*"]
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- { goos: linux, goarch: amd64 }
- { goos: linux, goarch: "386" }
- { goos: linux, goarch: arm64 }
- { goos: linux, goarch: arm, goarm: "7" }
- { goos: linux, goarch: ppc64le }
- { goos: linux, goarch: riscv64 }
- { goos: linux, goarch: s390x }
- { goos: linux, goarch: loong64 }
- { goos: darwin, goarch: amd64 }
- { goos: darwin, goarch: arm64 }
- { goos: windows, goarch: amd64 }
- { goos: windows, goarch: "386" }
- { goos: windows, goarch: arm64 }
- { goos: freebsd, goarch: amd64 }
- { goos: freebsd, goarch: arm64 }
- { goos: openbsd, goarch: amd64 }
- { goos: openbsd, goarch: arm64 }
- { goos: netbsd, goarch: amd64 }
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
cache: true
# Runs natively: GOOS/GOARCH are scoped to the build step below so
# templ (a Go tool) is built and executed for the runner, not the target.
- name: Generate templ code
run: go tool templ generate
- name: Build and package
env:
CGO_ENABLED: 0
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
GOARM: ${{ matrix.goarm }}
run: |
ext=""
[ "$GOOS" = "windows" ] && ext=".exe"
name="time-tracker_${GITHUB_REF_NAME}_${GOOS}_${GOARCH}"
mkdir -p "build/${name}"
go build -trimpath -ldflags "-s -w" -o "build/${name}/time-tracker${ext}" ./cmd/time-tracker
cp README.md LICENSE "build/${name}/"
mkdir -p dist
tar -czf "dist/${name}.tar.gz" -C build "${name}"
- name: Upload build artifact
uses: actions/upload-artifact@v7
with:
name: release-${{ matrix.goos }}-${{ matrix.goarch }}
path: dist/*.tar.gz
if-no-files-found: error
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download build artifacts
uses: actions/download-artifact@v8
with:
pattern: release-*
merge-multiple: true
path: dist
- name: Publish release
uses: softprops/action-gh-release@v3
with:
files: dist/*.tar.gz
generate_release_notes: true