Skip to content

Commit 82b9e70

Browse files
LauJosefsenclaude
andcommitted
Add release workflow for cross-platform binaries
Builds and publishes gitte binaries for linux-amd64, linux-arm64, windows-amd64, darwin-amd64, and darwin-arm64 on semver tags and RC tags (x.y.z-rc.N). Creates a GitHub Release with auto-generated notes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 91ff6cf commit 82b9e70

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
name: release
3+
on:
4+
push:
5+
tags:
6+
- '[0-9]+.[0-9]+.[0-9]+'
7+
- '[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+'
8+
workflow_dispatch:
9+
10+
jobs:
11+
release:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: actions/setup-go@v5
19+
with:
20+
go-version-file: go.mod
21+
cache: true
22+
23+
- name: Build linux-amd64
24+
run: GOOS=linux GOARCH=amd64 go build -ldflags "-X main.version=${GITHUB_REF_NAME}" -o bin/linux-amd64/gitte .
25+
- run: tar czf bin/gitte-linux-amd64.tar.gz -C bin/linux-amd64 gitte
26+
27+
- name: Build linux-arm64
28+
run: GOOS=linux GOARCH=arm64 go build -ldflags "-X main.version=${GITHUB_REF_NAME}" -o bin/linux-arm64/gitte .
29+
- run: tar czf bin/gitte-linux-arm64.tar.gz -C bin/linux-arm64 gitte
30+
31+
- name: Build windows-amd64
32+
run: GOOS=windows GOARCH=amd64 go build -ldflags "-X main.version=${GITHUB_REF_NAME}" -o bin/windows-amd64/gitte.exe .
33+
- run: (cd bin/windows-amd64 && zip ../gitte-windows-amd64.zip gitte.exe)
34+
35+
- name: Build darwin-amd64
36+
run: GOOS=darwin GOARCH=amd64 go build -ldflags "-X main.version=${GITHUB_REF_NAME}" -o bin/darwin-amd64/gitte .
37+
- run: tar czf bin/gitte-darwin-amd64.tar.gz -C bin/darwin-amd64 gitte
38+
39+
- name: Build darwin-arm64
40+
run: GOOS=darwin GOARCH=arm64 go build -ldflags "-X main.version=${GITHUB_REF_NAME}" -o bin/darwin-arm64/gitte .
41+
- run: tar czf bin/gitte-darwin-arm64.tar.gz -C bin/darwin-arm64 gitte
42+
43+
- name: Create GitHub Release
44+
if: github.ref_type == 'tag'
45+
run: |
46+
gh release create "${GITHUB_REF_NAME}" bin/gitte-*.tar.gz bin/gitte-*.zip --generate-notes ||
47+
gh release upload "${GITHUB_REF_NAME}" bin/gitte-*.tar.gz bin/gitte-*.zip --clobber
48+
env:
49+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)