Skip to content

Commit 875cb85

Browse files
authored
Add release job (#5)
* add release job * Update and rename go-build.yaml to build-release.yaml * extract version from main.go * add missing checkout * release only main & `merge-multiple` enabled * refactor: simplify * Update build-release.yaml * revert back to empty version string * add `-checklinkname=0`
1 parent 1c5d55b commit 875cb85

File tree

3 files changed

+77
-94
lines changed

3 files changed

+77
-94
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Build & Release
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types: [published]
7+
push:
8+
9+
jobs:
10+
build:
11+
permissions:
12+
contents: write
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
include:
17+
- goos: darwin
18+
goarch: amd64
19+
- goos: darwin
20+
goarch: arm64
21+
- goos: android
22+
goarch: arm64
23+
- goos: linux
24+
goarch: amd64
25+
- goos: linux
26+
goarch: arm64
27+
- goos: linux
28+
goarch: arm
29+
goarm: 7
30+
- goos: windows
31+
goarch: amd64
32+
- goos: windows
33+
goarch: arm64
34+
35+
runs-on: ubuntu-latest
36+
env:
37+
GOOS: ${{ matrix.goos }}
38+
GOARCH: ${{ matrix.goarch }}
39+
GOARM: ${{ matrix.goarm }}
40+
CGO_ENABLED: 0
41+
steps:
42+
- name: Checkout codebase
43+
uses: actions/checkout@v4
44+
45+
- name: Show workflow information
46+
run: |
47+
export _NAME=$GOOS-$GOARCH${GOARM}
48+
echo "GOOS: $GOOS, GOARCH: $GOARCH, GOARM: $GOARM, RELEASE_NAME: $_NAME"
49+
echo "ASSET_NAME=$_NAME" >> $GITHUB_ENV
50+
echo "REF=${GITHUB_SHA::6}" >> $GITHUB_ENV
51+
52+
- name: Set up Go
53+
uses: actions/setup-go@v5
54+
with:
55+
go-version: '1.24'
56+
check-latest: true
57+
58+
- name: Build heybabe
59+
run: |
60+
go build -v -o heybabe_${{ env.ASSET_NAME }}/ -trimpath -ldflags "-s -w -buildid= -checklinkname=0 -X main.version=${{ github.ref }}" .
61+
62+
- name: Upload heybabe binary to Artifacts
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: heybabe_${{ env.ASSET_NAME }}_${{ env.REF }}
66+
path: ./heybabe_${{ env.ASSET_NAME }}/*
67+
68+
- name: Upload binary to GitHub Release
69+
if: github.event_name == 'release'
70+
uses: svenstaro/upload-release-action@v2
71+
with:
72+
repo_token: ${{ secrets.GITHUB_TOKEN }}
73+
file: ./heybabe_${{ env.ASSET_NAME }}/*
74+
tag: ${{ github.ref }}
75+
file_glob: true
76+

.github/workflows/go-build.yaml

Lines changed: 0 additions & 93 deletions
This file was deleted.

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
const appName = "heybabe"
1919

2020
var (
21-
version = "0.0.1"
21+
version = ""
2222
logLevels = []string{
2323
slog.LevelDebug.String(),
2424
slog.LevelInfo.String(),

0 commit comments

Comments
 (0)