Files
emcli/.gitea/workflows/release.yml
T
steve dfb434aec3 ci(release): use the tag annotation as the release description
The release was created with no body; now the annotated tag's message
is published as the release notes (lightweight tags keep an empty body).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-07 14:29:01 +01:00

58 lines
2.2 KiB
YAML

# Builds cross-platform binaries and publishes a Gitea release when a version tag
# (e.g. v0.4.0) is pushed. Produces the same assets as `make release` and uploads
# them — so the skill installer (skills/emcli/scripts/install.sh) can fetch them.
#
# Requires: Gitea Actions enabled with a runner that has Go, make, curl, and jq
# (the actions/checkout + actions/setup-go steps need the instance's Actions proxy).
# Verified: this workflow published v0.4.0 on this instance. If a step is ever
# unavailable on your runner, the same result comes from `make release && make
# publish` locally (see RELEASING.md).
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-file: go.mod
- name: Build release artifacts
run: make release VERSION="${GITHUB_REF_NAME}"
- name: Create release and upload assets
env:
TOKEN: ${{ github.token }}
SERVER: ${{ github.server_url }}
REPO: ${{ github.repository }}
TAG: ${{ github.ref_name }}
run: |
set -euo pipefail
# Create the release for the pushed tag. The annotated tag's message
# becomes the release description (empty for lightweight tags).
body=$(git tag -l --format='%(contents)' "${TAG}")
payload=$(jq -n --arg tag "${TAG}" --arg body "${body}" \
'{tag_name: $tag, name: $tag, body: $body}')
id=$(curl -fsSL -X POST \
-H "Authorization: token ${TOKEN}" \
-H "Content-Type: application/json" \
"${SERVER}/api/v1/repos/${REPO}/releases" \
-d "${payload}" | jq -r '.id')
echo "release id: ${id}"
# Upload every built asset (binaries + checksums.txt).
for f in dist/*; do
name=$(basename "$f")
echo "uploading ${name}"
curl -fsSL -X POST \
-H "Authorization: token ${TOKEN}" \
-F "attachment=@${f}" \
"${SERVER}/api/v1/repos/${REPO}/releases/${id}/assets?name=${name}" >/dev/null
done
echo "published ${TAG}"