Skip to content

Commit f6803ec

Browse files
author
Darren Kelly
committed
testing: goreleaser
1 parent 49a3745 commit f6803ec

File tree

2 files changed

+61
-20
lines changed

2 files changed

+61
-20
lines changed

.github/workflows/release-binaries.yaml

Lines changed: 51 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,63 @@ permissions:
1010
packages: write
1111

1212
jobs:
13-
release:
14-
runs-on: ubuntu-latest
13+
build:
14+
name: Release Binary (${{ matrix.goos }}-${{ matrix.goarch }})
15+
runs-on: ${{ matrix.runner }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
include:
20+
- goos: linux
21+
goarch: amd64
22+
runner: ubuntu-latest
23+
ext: ""
24+
- goos: linux
25+
goarch: arm64
26+
runner: ubuntu-24.04-arm64
27+
ext: ""
28+
- goos: darwin
29+
goarch: arm64
30+
runner: macos-latest
31+
ext: ""
32+
- goos: windows
33+
goarch: amd64
34+
runner: windows-latest
35+
ext: ".exe"
36+
1537
steps:
1638
- uses: actions/checkout@v5
17-
1839
- uses: actions/setup-go@v5
1940
with:
20-
go-version: "1.24"
41+
go-version: 1.24
2142

22-
- name: Install cross-compilers
23-
run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu gcc-mingw-w64
24-
25-
- name: Set Env
43+
- name: Build binary
44+
shell: bash
2645
run: |
27-
echo "THOR_VERSION=$(cat cmd/thor/VERSION)" >> $GITHUB_ENV
28-
echo "DISCO_VERSION=$(cat cmd/disco/VERSION)" >> $GITHUB_ENV
29-
echo "COPYRIGHT_YEAR=$(git --no-pager log -1 --format=%ad --date=format:%Y)" >> $GITHUB_ENV
46+
go mod tidy
47+
make thor
48+
mkdir -p dist
49+
mv ./bin/thor dist/thor_${{ matrix.goos }}_${{ matrix.goarch }}${{ matrix.ext }}
3050
31-
- name: Run GoReleaser
32-
uses: goreleaser/goreleaser-action@v6
33-
with:
34-
version: latest
35-
args: release --clean
3651
env:
37-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38-
THOR_VERSION: ${{ env.THOR_VERSION }}
39-
DISCO_VERSION: ${{ env.DISCO_VERSION }}
40-
COPYRIGHT_YEAR: ${{ env.COPYRIGHT_YEAR }}
52+
GOOS: ${{ matrix.goos }}
53+
GOARCH: ${{ matrix.goarch }}
4154
CGO_ENABLED: 1
55+
56+
- uses: actions/upload-artifact@v4
57+
with:
58+
name: thor_${{ matrix.goos }}_${{ matrix.goarch }}
59+
path: dist/thor_${{ matrix.goos }}_${{ matrix.goarch }}${{ matrix.ext }}
60+
61+
release:
62+
name: Create GitHub Release
63+
runs-on: ubuntu-latest
64+
needs: build
65+
steps:
66+
- uses: actions/download-artifact@v5
67+
with:
68+
path: dist
69+
- uses: ncipollo/release-action@v1
70+
with:
71+
artifacts: "dist/**/*"
72+
token: ${{ secrets.GITHUB_TOKEN }}

.goreleaser.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ before:
44
hooks:
55
- go mod tidy
66

7+
8+
env:
9+
- CGO_ENABLED=1
10+
711
builds:
812
- id: thor
913
main: ./cmd/thor
@@ -21,6 +25,9 @@ builds:
2125
goarch:
2226
- amd64
2327
- arm64
28+
env:
29+
- CGO_ENABLED=1
30+
- CC=aarch64-linux-gnu-gcc
2431

2532
- id: disco
2633
main: ./cmd/disco
@@ -38,6 +45,9 @@ builds:
3845
goarch:
3946
- amd64
4047
- arm64
48+
env:
49+
- CGO_ENABLED=1
50+
- CC=aarch64-linux-gnu-gcc
4151

4252
archives:
4353
- format: tar.gz

0 commit comments

Comments
 (0)