Skip to content

Commit a0322db

Browse files
committed
Create GH release on tags
1 parent f9872bb commit a0322db

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed

.github/workflows/release.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build:
13+
name: Build binaries
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
matrix:
17+
include:
18+
- os: ubuntu-latest
19+
goos: linux
20+
goarch: amd64
21+
artifact_name: rtask-linux-amd64
22+
- os: macos-latest
23+
goos: darwin
24+
goarch: amd64
25+
artifact_name: rtask-darwin-amd64
26+
- os: macos-latest
27+
goos: darwin
28+
goarch: arm64
29+
artifact_name: rtask-darwin-arm64
30+
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v4
34+
35+
- name: Set up Go
36+
uses: actions/setup-go@v5
37+
with:
38+
go-version: '1.25'
39+
cache: true
40+
41+
- name: Install just
42+
uses: extractions/setup-just@v2
43+
44+
- name: Build binary
45+
env:
46+
GOOS: ${{ matrix.goos }}
47+
GOARCH: ${{ matrix.goarch }}
48+
run: just build-release
49+
50+
- name: Rename binary
51+
run: mv rtask ${{ matrix.artifact_name }}
52+
53+
- name: Upload artifact
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: ${{ matrix.artifact_name }}
57+
path: ${{ matrix.artifact_name }}
58+
59+
release:
60+
name: Create GitHub Release
61+
needs: build
62+
runs-on: ubuntu-latest
63+
steps:
64+
- name: Checkout code
65+
uses: actions/checkout@v4
66+
67+
- name: Download all artifacts
68+
uses: actions/download-artifact@v4
69+
with:
70+
path: artifacts
71+
72+
- name: Create release
73+
env:
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
run: |
76+
# Extract version from tag
77+
VERSION=${GITHUB_REF#refs/tags/}
78+
79+
# Create release with all binaries
80+
gh release create "$VERSION" \
81+
--title "$VERSION" \
82+
--generate-notes \
83+
artifacts/*/*

justfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
build:
22
go build
33

4+
# Build optimized binary for releases (respects GOOS and GOARCH env vars)
5+
build-release:
6+
go build -ldflags="-s -w" -trimpath
7+
48
run *args: build
59
GO_LOG=debug ./rtask {{args}}
610

0 commit comments

Comments
 (0)