Skip to content

Commit 9c906a7

Browse files
committed
Add GitHub release action
1 parent f4f8a94 commit 9c906a7

1 file changed

Lines changed: 72 additions & 0 deletions

File tree

.github/workflows/release-test.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Test release
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
matrix:
18+
include:
19+
- os: linux
20+
arch: amd64
21+
- os: linux
22+
arch: arm64
23+
24+
- os: darwin
25+
arch: amd64
26+
- os: darwin
27+
arch: arm64
28+
29+
- os: windows
30+
arch: amd64
31+
- os: windows
32+
arch: arm64
33+
34+
steps:
35+
- name: Checkout
36+
uses: actions/checkout@v6
37+
38+
- name: Setup Go
39+
uses: actions/setup-go@v6
40+
with:
41+
go-version: "1.25"
42+
43+
- name: Build
44+
run: |
45+
mkdir -p dist
46+
EXT=""
47+
if [ "${{ matrix.os }}" = "windows" ]; then EXT=".exe"; fi
48+
49+
if [ "${{ github.ref_type }}" = "tag" ]; then
50+
VERSION="${{ github.ref_name }}"\
51+
else
52+
VERSION="0.0.0"
53+
fi
54+
55+
VERSION=${{ github.ref_name }}
56+
COMMIT=${{ github.sha }}
57+
DATE=$(date -u +%Y-%m-%dT%H:%M:%SZ)
58+
59+
GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} \
60+
go build \
61+
-ldflags "\
62+
-X constants.Version=$VERSION \
63+
-X constants.Commit=$COMMIT \
64+
-X constants.BuildDate=$DATE \
65+
" \
66+
-o dist/sklair-${{ matrix.os }}-${{ matrix.arch }}$EXT
67+
68+
- name: Upload artefacts
69+
uses: actions/upload-artifact@v6
70+
with:
71+
name: sklair-${{ matrix.os }}-${{ matrix.arch }}
72+
path: dist/*

0 commit comments

Comments
 (0)