f53dfa1c4c
Four defects from the rc.1 dress rehearsal: - Dockerfile pinned golang:1.26-alpine3.23 at a 1.26.3 digest while go.mod requires 1.26.4; golang images set GOTOOLCHAIN=local, so the build hard-fails. Pin 1.26.4-alpine3.23 explicitly. - changelog.disable swallowed --release-notes (the flag is consumed by the changelog pipe), publishing empty release bodies. Re-enable. - Remove the Gitea-side GitHub relay step: redundant with .github/workflows/mirror-release.yml, which runs on GitHub Actions with the built-in token and copies the canonical Gitea assets. - mirror-release.yml: jq '.body // empty' treats "" as truthy so the notes fallback never fired; use select(). Mark rc tags --prerelease.
75 lines
2.5 KiB
YAML
75 lines
2.5 KiB
YAML
name: Mirror Release to GitHub
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v[0-9]*"
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
mirror:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Wait for Gitea release
|
|
id: gitea
|
|
env:
|
|
TAG: ${{ github.ref_name }}
|
|
run: |
|
|
API="https://gitea.lerkolabs.com/api/v1/repos/lerkolabs/uptop/releases/tags/${TAG}"
|
|
|
|
for i in $(seq 1 20); do
|
|
if RESPONSE=$(curl -sf "$API" 2>/dev/null); then
|
|
ASSET_COUNT=$(echo "$RESPONSE" | jq '.assets | length')
|
|
if [ "$ASSET_COUNT" -gt 0 ]; then
|
|
echo "Found release with $ASSET_COUNT assets"
|
|
break
|
|
fi
|
|
echo "Release exists but no assets yet... attempt $i/20"
|
|
else
|
|
echo "Waiting for Gitea release... attempt $i/20"
|
|
fi
|
|
sleep 30
|
|
done
|
|
|
|
if [ -z "$RESPONSE" ] || [ "$ASSET_COUNT" -eq 0 ]; then
|
|
echo "::error::Gitea release for ${TAG} not found or has no assets after 10 minutes"
|
|
exit 1
|
|
fi
|
|
|
|
# select() so an empty-string body produces an empty file — `// empty`
|
|
# treats "" as truthy and wrote a blank line, defeating this fallback.
|
|
echo "$RESPONSE" | jq -r '.body | select(. != null and . != "")' > /tmp/release-notes.md
|
|
|
|
if [ ! -s /tmp/release-notes.md ]; then
|
|
echo "Release ${TAG} from [Gitea](https://gitea.lerkolabs.com/lerkolabs/uptop/releases/tag/${TAG})" > /tmp/release-notes.md
|
|
fi
|
|
|
|
mkdir -p /tmp/assets
|
|
echo "$RESPONSE" | jq -r '.assets[] | .browser_download_url' | while read -r url; do
|
|
filename=$(basename "$url")
|
|
echo "Downloading $filename"
|
|
curl -sSL -o "/tmp/assets/${filename}" "$url"
|
|
done
|
|
|
|
- name: Delete existing GitHub release
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
TAG: ${{ github.ref_name }}
|
|
run: gh release delete "$TAG" --repo "$GITHUB_REPOSITORY" --yes 2>/dev/null || true
|
|
|
|
- name: Create GitHub release
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
TAG: ${{ github.ref_name }}
|
|
run: |
|
|
PRERELEASE=""
|
|
case "$TAG" in *-*) PRERELEASE="--prerelease" ;; esac
|
|
gh release create "$TAG" \
|
|
--repo "$GITHUB_REPOSITORY" \
|
|
--title "$TAG" \
|
|
--notes-file /tmp/release-notes.md \
|
|
$PRERELEASE \
|
|
/tmp/assets/*
|