Files
rb-search/.gitea/workflows/release.yml
Alex Shlyakhov be3251716c
Some checks failed
release / release (push) Has been cancelled
Build infrastructure for releases
- Makefile: cross-compile to linux/{amd64,arm64}, darwin/{amd64,arm64},
  windows/amd64 into dist/ with SHA256SUMS. Version is stamped via
  -ldflags '-X main.version=...'.
- .gitea/workflows/release.yml: on tag push (v*) the workflow runs
  `make dist`, creates a Gitea release for the tag and uploads every
  artefact from dist/ via the Gitea API.
- main.go: `rb-search version` / --version prints the stamped version.
- README: new "Готовые бинари" section with curl/Invoke-WebRequest
  install snippets and a checksum-verify hint.
2026-05-26 13:46:16 +05:00

52 lines
1.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: release
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Build cross-platform binaries
run: make dist VERSION=${{ github.ref_name }}
- name: Create release and upload assets
env:
TOKEN: ${{ secrets.GITEA_TOKEN }}
API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
TAG: ${{ github.ref_name }}
run: |
set -euo pipefail
body=$(cat <<EOF
Автоматический релиз $TAG.
Скачайте бинарь под свою ОС/архитектуру и положите на PATH.
Проверка целостности: \`sha256sum -c SHA256SUMS\`.
EOF
)
payload=$(jq -n --arg tag "$TAG" --arg body "$body" \
'{tag_name:$tag, name:$tag, body:$body, draft:false, prerelease:false}')
release_id=$(curl -fsSL -X POST \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
-d "$payload" \
"$API/releases" | jq -r .id)
for f in dist/*; do
name=$(basename "$f")
echo "uploading $name"
curl -fsSL -X POST \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/octet-stream" \
--data-binary "@$f" \
"$API/releases/$release_id/assets?name=$name" >/dev/null
done
echo "released $TAG with $(ls dist | wc -l) assets"