d538aad18e
GoReleaser publishes to exactly one SCM (Gitea); the push mirror carries refs but not releases, so GitHub Releases — where the README points — stayed empty. After the Gitea release, wait for the mirrored tag and create the GitHub release with the same artifacts and notes. Needs new Gitea secret GH_MIRROR_TOKEN (GitHub PAT with repo scope). GITHUB_TOKEN is reserved by Gitea Actions, hence the different name.
86 lines
2.6 KiB
YAML
86 lines
2.6 KiB
YAML
name: Release Binaries
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v[0-9]*"
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
shell: sh
|
|
steps:
|
|
- name: Install build tools
|
|
run: apk add --no-cache git
|
|
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- uses: actions/setup-go@v5
|
|
with:
|
|
go-version: "1.26"
|
|
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/go/pkg/mod
|
|
~/.cache/go-build
|
|
key: release-go-${{ hashFiles('go.sum') }}
|
|
restore-keys: release-go-
|
|
|
|
- name: Install git-cliff
|
|
run: |
|
|
apk add --no-cache curl
|
|
VERSION=2.13.1
|
|
curl -sSL "https://github.com/orhun/git-cliff/releases/download/v${VERSION}/git-cliff-${VERSION}-x86_64-unknown-linux-musl.tar.gz" | tar xz -C /tmp
|
|
mv /tmp/git-cliff-*/git-cliff /usr/local/bin/
|
|
git-cliff --version
|
|
|
|
- name: Generate release notes
|
|
run: git-cliff --current --strip header -o /tmp/release-notes.md
|
|
|
|
- name: Run GoReleaser
|
|
uses: goreleaser/goreleaser-action@v7
|
|
with:
|
|
distribution: goreleaser
|
|
version: "~> v2"
|
|
args: release --clean --release-notes=/tmp/release-notes.md
|
|
env:
|
|
GORELEASER_FORCE_TOKEN: gitea
|
|
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
|
GITEA_API_URL: http://gitea:3000/api/v1
|
|
|
|
# GoReleaser publishes to exactly one SCM (Gitea). The push mirror
|
|
# carries git refs but not release artifacts, so relay the release to
|
|
# the GitHub mirror — README install links point there.
|
|
- name: Mirror release to GitHub
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GH_MIRROR_TOKEN }}
|
|
run: |
|
|
apk add --no-cache github-cli
|
|
TAG="${{ github.ref_name }}"
|
|
|
|
# Nudge the push mirror, then wait for the tag to land on GitHub.
|
|
curl -sf -X POST \
|
|
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
|
|
"http://gitea:3000/api/v1/repos/lerkolabs/uptop/push_mirrors-sync" || true
|
|
for i in $(seq 1 30); do
|
|
if gh api "repos/lerkolabs/uptop/git/ref/tags/${TAG}" >/dev/null 2>&1; then
|
|
break
|
|
fi
|
|
sleep 10
|
|
done
|
|
|
|
PRERELEASE=""
|
|
case "$TAG" in *-*) PRERELEASE="--prerelease";; esac
|
|
gh release create "$TAG" \
|
|
--repo lerkolabs/uptop \
|
|
--verify-tag \
|
|
--title "$TAG" \
|
|
--notes-file /tmp/release-notes.md \
|
|
$PRERELEASE \
|
|
dist/*.tar.gz dist/*.zip dist/*.deb dist/*.rpm dist/checksums.txt
|