CI: the GitHub mirror keeps the last 30 releases (Gitea 5) as an archive
Changelog: - Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
20477d299a
commit
73d14e60a1
2 files changed
+17
-13
No files matched your search
@@ -5,10 +5,13 @@
|
||||
# the release notes' links point there, and integrity rests on the signed
|
||||
# SHA256SUMS, not on the host.
|
||||
#
|
||||
# Converges instead of copying "the one new release": every run makes the
|
||||
# GitHub side equal to the newest $KEEP releases of Gitea -- creates what is
|
||||
# missing, uploads assets a failed run left out, deletes GitHub releases that
|
||||
# Gitea pruned (their tags stay). A GitHub outage is mended by the next run.
|
||||
# Converges instead of copying "the one new release": every run brings the
|
||||
# newest $KEEP releases of Gitea over -- creates what is missing, uploads
|
||||
# assets a failed run left out -- so a GitHub outage is mended by the next
|
||||
# run. GitHub is the ARCHIVE: Gitea keeps $KEEP, GitHub the newest $GH_KEEP
|
||||
# (older ones are deleted, their tags stay), so an older build stays
|
||||
# downloadable for a rollback over USB/BLE. Their notes' links to Gitea
|
||||
# release pages die with Gitea's pruning; the mirror header links the list.
|
||||
#
|
||||
# A release is created only once GitHub has its commit (the export pushes it
|
||||
# as branch `tth` in tth-upstream-sync.yml); until then it is skipped with a
|
||||
@@ -19,7 +22,7 @@
|
||||
#
|
||||
# env: GH_TOKEN (fine-grained, Contents: write on GH_REPO), GITEA (default
|
||||
# https://git.rfa.cz), SRC_REPO (tth-pub/meshcore-tth), GH_REPO
|
||||
# (TeTeHacko/MeshCore-TTH), KEEP (5).
|
||||
# (TeTeHacko/MeshCore-TTH), KEEP (5, as pub-release.yml), GH_KEEP (30).
|
||||
set -euo pipefail
|
||||
|
||||
case "${1:-}" in
|
||||
@@ -39,6 +42,7 @@ GITEA=${GITEA:-https://git.rfa.cz}
|
||||
SRC_REPO=${SRC_REPO:-tth-pub/meshcore-tth}
|
||||
GH_REPO=${GH_REPO:-TeTeHacko/MeshCore-TTH}
|
||||
KEEP=${KEEP:-5}
|
||||
GH_KEEP=${GH_KEEP:-30}
|
||||
src="$GITEA/api/v1/repos/$SRC_REPO"
|
||||
gh="https://api.github.com/repos/$GH_REPO"
|
||||
up="https://uploads.github.com/repos/$GH_REPO"
|
||||
@@ -78,8 +82,8 @@ while read -r rel; do
|
||||
echo "create $tag ($sha)"
|
||||
[ "$DRY" = 1 ] && continue
|
||||
body=$(
|
||||
echo "> **Zrcadlo** · mirror of $GITEA/$SRC_REPO/releases/tag/$(enc "$tag") -- primární zdroj"
|
||||
echo "> (auto-OTA, podpisy \`SHA256SUMS\`) je git.rfa.cz."
|
||||
echo "> **Zrcadlo** · mirror of $GITEA/$SRC_REPO/releases -- primární zdroj (auto-OTA,"
|
||||
echo "> podpisy \`SHA256SUMS\`) je git.rfa.cz; tam drží posledních $KEEP vydání, tady $GH_KEEP."
|
||||
echo
|
||||
jq -r .body <<<"$rel"
|
||||
)
|
||||
@@ -103,11 +107,11 @@ while read -r rel; do
|
||||
[ "$n" = 0 ] || echo "$tag: $n asset(s) $([ "$DRY" = 1 ] && echo "to upload" || echo uploaded)"
|
||||
done <"$tmp/src.jsonl"
|
||||
|
||||
# Gitea pruned it: the GitHub copy goes too (the tag stays, like the export's)
|
||||
jq -r '.tag_name' "$tmp/src.jsonl" >"$tmp/keep"
|
||||
jq -r 'select(.tag_name | startswith("tth-") or test("[+]tth[.]")) | "\(.id) \(.tag_name)"' "$tmp/gh.jsonl" |
|
||||
# the archive keeps the newest $GH_KEEP (the tags stay, like the export's)
|
||||
[ "$DRY" = 1 ] || ghapi -f "$gh/releases?per_page=100" | jq -c '.[]' >"$tmp/gh.jsonl"
|
||||
jq -sr --argjson k "$GH_KEEP" 'map(select(.tag_name | startswith("tth-") or test("[+]tth[.]")))
|
||||
| sort_by(.created_at) | reverse | .[$k:][] | "\(.id) \(.tag_name)"' "$tmp/gh.jsonl" |
|
||||
while read -r id tag; do
|
||||
grep -qxF "$tag" "$tmp/keep" && continue
|
||||
echo "prune $tag"
|
||||
[ "$DRY" = 1 ] || ghapi -f -X DELETE "$gh/releases/$id" >/dev/null
|
||||
done
|
||||
@@ -271,7 +271,7 @@ Každý release je automatický build nad upstreamovým `dev` (viz upozornění
|
||||
nahoře), ne stabilní verze. Nahrávejte ho jen na uzly, na které dosáhnete,
|
||||
a nový release vždy nejdřív na jeden z nich.
|
||||
|
||||
Soubory jsou v [Releases](https://git.rfa.cz/tth-pub/meshcore-tth/releases); totéž zrcadlí
|
||||
Soubory jsou v [Releases](https://git.rfa.cz/tth-pub/meshcore-tth/releases); totéž zrcadlí, i se staršími (posledních 30 proti 5),
|
||||
[GitHub](https://github.com/TeTeHacko/MeshCore-TTH/releases) (`.github/gh-release-mirror.sh`).
|
||||
Release se jmenuje podle upstreamové verze a data, např.
|
||||
`v1.18.0+tth.20261112` (druhý téhož dne `.2`), a v popisu má změny od
|
||||
@@ -643,7 +643,7 @@ Every release is an automatic build on upstream `dev` (see the warning
|
||||
above), not a stable version. Flash it only on nodes you can reach, and each
|
||||
new release on one of them first.
|
||||
|
||||
Files are in [Releases](https://git.rfa.cz/tth-pub/meshcore-tth/releases), mirrored to
|
||||
Files are in [Releases](https://git.rfa.cz/tth-pub/meshcore-tth/releases), mirrored, older ones included (the last 30 against 5), to
|
||||
[GitHub](https://github.com/TeTeHacko/MeshCore-TTH/releases) (`.github/gh-release-mirror.sh`).
|
||||
A release is named after the upstream version and the date, e.g.
|
||||
`v1.18.0+tth.20261112` (a second one that day `.2`), and its notes list the
|
||||
|
||||
Reference in new issue
Block a user