Skip to content

Commit 2d7d946

Browse files
abdullahainunclaude
andcommitted
feat: add GitHub Actions release workflow
- Add automated release workflow for multi-platform builds - Support Linux, macOS, and Windows (AMD64/ARM64) - Include checksum generation for security - Auto-generate release notes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent a07e0fa commit 2d7d946

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

.github/workflows/release.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
version: ${{ steps.version.outputs.version }}
13+
build_time: ${{ steps.version.outputs.build_time }}
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Go
18+
uses: actions/setup-go@v5
19+
with:
20+
go-version: '1.23'
21+
22+
- name: Get version info
23+
id: version
24+
run: |
25+
VERSION=${GITHUB_REF#refs/tags/}
26+
BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
27+
echo "version=$VERSION" >> $GITHUB_OUTPUT
28+
echo "build_time=$BUILD_TIME" >> $GITHUB_OUTPUT
29+
30+
- name: Run tests
31+
run: make test
32+
33+
- name: Build for multiple platforms
34+
run: |
35+
LDFLAGS="-ldflags \"-X main.version=${{ steps.version.outputs.version }} -X main.buildTime=${{ steps.version.outputs.build_time }}\""
36+
37+
# Linux AMD64
38+
GOOS=linux GOARCH=amd64 go build $LDFLAGS -o tenangdb-linux-amd64 cmd/main.go
39+
40+
# Linux ARM64
41+
GOOS=linux GOARCH=arm64 go build $LDFLAGS -o tenangdb-linux-arm64 cmd/main.go
42+
43+
# macOS AMD64
44+
GOOS=darwin GOARCH=amd64 go build $LDFLAGS -o tenangdb-darwin-amd64 cmd/main.go
45+
46+
# macOS ARM64
47+
GOOS=darwin GOARCH=arm64 go build $LDFLAGS -o tenangdb-darwin-arm64 cmd/main.go
48+
49+
# Windows AMD64
50+
GOOS=windows GOARCH=amd64 go build $LDFLAGS -o tenangdb-windows-amd64.exe cmd/main.go
51+
52+
- name: Create checksums
53+
run: |
54+
sha256sum tenangdb-* > checksums.txt
55+
56+
- name: Create release
57+
uses: softprops/action-gh-release@v1
58+
with:
59+
files: |
60+
tenangdb-linux-amd64
61+
tenangdb-linux-arm64
62+
tenangdb-darwin-amd64
63+
tenangdb-darwin-arm64
64+
tenangdb-windows-amd64.exe
65+
checksums.txt
66+
generate_release_notes: true
67+
draft: false
68+
prerelease: false
69+
env:
70+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)