Some checks failed
release / release (push) Has been cancelled
- 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.
52 lines
1.6 KiB
YAML
52 lines
1.6 KiB
YAML
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"
|