chore(build): add Gitea Actions release pipeline
release / Build (${{ matrix.goos }}/${{ matrix.goarch }}) (amd64, linux, -linux-amd64) (push) Failing after 11m48s
release / Build (${{ matrix.goos }}/${{ matrix.goarch }}) (amd64, windows, .exe) (push) Failing after 5m16s
release / Publish release (push) Has been skipped

Builds Linux x64 and Windows x64 binaries on tag pushes (v*) and
publishes them as assets on a Gitea release via the REST API.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-11 00:38:21 +02:00
parent 88f20165db
commit e7b51929f8
+77
View File
@@ -0,0 +1,77 @@
name: release
on:
push:
tags:
- 'v*'
jobs:
build:
name: Build (${{ matrix.goos }}/${{ matrix.goarch }})
runs-on: ubuntu-latest
strategy:
matrix:
include:
- goos: linux
goarch: amd64
suffix: -linux-amd64
- goos: windows
goarch: amd64
suffix: .exe
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: "0"
run: |
go build -trimpath -ldflags="-s -w" \
-o glint-${{ github.ref_name }}${{ matrix.suffix }} \
./cmd/glint/...
- uses: actions/upload-artifact@v4
with:
name: binary-${{ matrix.goos }}-${{ matrix.goarch }}
path: glint-${{ github.ref_name }}${{ matrix.suffix }}
retention-days: 7
release:
name: Publish release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: binary-*
merge-multiple: true
- name: Create release and upload assets
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
API_URL: ${{ github.api_url }}
REPO: ${{ github.repository }}
run: |
release_id=$(curl -sf -X POST \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
"$API_URL/repos/$REPO/releases" \
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"draft\":false,\"prerelease\":false}" \
| jq -r .id)
for file in glint-*; do
curl -sf -X POST \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/octet-stream" \
"$API_URL/repos/$REPO/releases/$release_id/assets?name=$(basename "$file")" \
--data-binary "@$file"
echo "uploaded: $file"
done