chore(ci): add GitHub Actions workflow for release process
Some checks failed
Release / test (push) Successful in -30m15s
Release / release (push) Failing after -29m26s

* Implement test and release jobs for versioned tags
* Build binaries for multiple OS/architecture targets
* Create release and upload assets to GitHub
* Add release-version target in Makefile for version bumping
This commit is contained in:
Hein
2026-04-08 11:29:50 +02:00
parent a8c12c8c21
commit 125b73289a
3 changed files with 86 additions and 1 deletions

View File

@@ -0,0 +1,57 @@
name: Release
on:
push:
tags:
- 'v*'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Test
run: go test ./...
- name: Lint
run: go vet ./...
release:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Build release binaries
run: |
VERSION="${GITHUB_REF_NAME}"
for target in "linux/amd64" "linux/arm64" "darwin/amd64" "darwin/arm64" "windows/amd64"; do
GOOS="${target%/*}"
GOARCH="${target#*/}"
EXT=""
[ "$GOOS" = "windows" ] && EXT=".exe"
NAME="unitdore-${GOOS}-${GOARCH}${EXT}"
GOOS="$GOOS" GOARCH="$GOARCH" go build \
-ldflags "-X main.version=${VERSION}" \
-o "$NAME" .
echo "Built $NAME"
done
- name: Create release and upload assets
uses: softprops/action-gh-release@v2
with:
files: unitdore-*
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}