ci: add Gitea release workflow using tea CLI

This commit is contained in:
2026-07-02 09:20:06 -05:00
parent 41a491564f
commit a7a561fbbd
+61
View File
@@ -0,0 +1,61 @@
name: Release
on:
push:
tags: ['v*']
workflow_dispatch:
jobs:
release:
runs-on: cpu
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
- name: Build cross-platform binaries
run: |
set -euo pipefail
mkdir -p dist
build() {
os=$1
label=$2
goarch=$3
echo "building dist/shush-${os}-${label}"
CGO_ENABLED=0 GOOS="$os" GOARCH="$goarch" go build -ldflags="-w -s" -o "dist/shush-${os}-${label}" ./cmd/shush
}
build linux x86_64 amd64
build linux aarch64 arm64
build darwin x86_64 amd64
build darwin aarch64 arm64
ls -la dist
- name: Create Gitea release
env:
TAG: ${{ github.ref_name }}
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
run: |
set -euo pipefail
if ! command -v tea >/dev/null 2>&1; then
echo "tea CLI not installed on runner; install from https://dl.gitea.com/tea/"
exit 1
fi
if [ -z "${TAG:-}" ]; then
echo "no tag ref; run this workflow from a v* tag"
exit 1
fi
tea login add --name ci --url https://git.mroberts.dev --token "$GITEA_TOKEN"
tea releases create \
--login ci \
--repo mroberts/sush \
--tag "$TAG" \
--title "$TAG" \
--asset dist/shush-linux-x86_64 \
--asset dist/shush-linux-aarch64 \
--asset dist/shush-darwin-x86_64 \
--asset dist/shush-darwin-aarch64