Skip to content

Commit c4f8b01

Browse files
ci(release): the index bump is proposed by the index's own updater (#837)
Since openxlings/xim-pkgindex#1027 one updater edits every recipe and version-check.py is gone, so the 2026.10.24.1 release's publish-ecosystem failed. bump_index.sh dispatches xpkgindex-update.yml for xim:<project> and waits for auto/bump-xim-<project>-<version>, failing when it does not appear. Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>
1 parent d5ec182 commit c4f8b01

2 files changed

Lines changed: 40 additions & 65 deletions

File tree

‎.github/tools/bump_index.sh‎

Lines changed: 38 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,55 @@
11
#!/usr/bin/env bash
2-
# Open a PR against openxlings/xim-pkgindex that bumps <project> to <version>.
2+
# Ask openxlings/xim-pkgindex to propose <project> <version>, and wait for the PR.
33
#
4-
# The actual lua edit is delegated to the index repo's OWN
5-
# `.github/scripts/version-check.py --apply --only <project>`, so this script
6-
# stays agnostic to each package's contract:
7-
# - res_versioned packages (e.g. xlings): appends `["<ver>"] = "XLINGS_RES"`.
8-
# - url_template packages (e.g. mcpp): downloads the artifact, computes
9-
# sha256, appends `["<ver>"] = { url, sha256 }`.
10-
# and always bumps `["latest"].ref`. Existing version entries are untouched.
4+
# The index edits its own recipes. Since openxlings/xim-pkgindex#1027 one
5+
# updater does it for every package (`xpkgindex-update.yml`, pinned
6+
# openxlings/xpkgindex-update): it discovers the release from the recipe's
7+
# `extensions.autoupdate.source` (xlings-res/<project> releases), requires the
8+
# GLOBAL and CN resources, computes each sha256 and opens
9+
# `auto/bump-xim-<project>-<version>`. The script that used to do this here,
10+
# `.github/scripts/version-check.py`, was removed from the index by that
11+
# change; 2026.10.24.1 is the release that found out (publish-ecosystem
12+
# failed on the missing file). Asking the index's own updater keeps one writer
13+
# of the recipe.
1114
#
12-
# This opens a PR only — a maintainer reviews and merges it (index git source
13-
# is intentionally NOT on the release critical path; availability is already
14-
# guaranteed by the xlings-res binary mirror + index artifact). On merge, the
15-
# index repo republishes its artifact + gitee-sync picks it up.
15+
# This opens a PR only -- a maintainer reviews and merges it. It runs after
16+
# the binaries are mirrored, because the updater requires both hosts.
1617
#
17-
# Usage: tools/bump_index.sh <project> <version> # e.g. mcpp 0.0.82
18+
# Usage: bump_index.sh <project> <version> # e.g. mcpp 2026.10.24.1
1819
# Auth:
19-
# PKGINDEX_TOKEN (required) — write to openxlings/xim-pkgindex (clone/push/PR)
20-
# GITHUB_TOKEN (optional) — GitHub API rate headroom + artifact download
21-
# for url_template packages (version-check.py)
20+
# PKGINDEX_TOKEN (required) -- may dispatch workflows of openxlings/xim-pkgindex
2221
set -euo pipefail
2322

2423
PROJ="${1:?usage: bump_index.sh <project> <version>}"
2524
VER="${2:?usage: bump_index.sh <project> <version>}"
2625
INDEX_REPO="${INDEX_REPO:-openxlings/xim-pkgindex}"
27-
BRANCH="bump/${PROJ}-${VER}"
28-
TOKEN="${PKGINDEX_TOKEN:?PKGINDEX_TOKEN required (write to $INDEX_REPO)}"
26+
BRANCH="auto/bump-xim-${PROJ}-${VER}"
27+
WAIT_S="${BUMP_WAIT_S:-1200}"
28+
export GH_TOKEN="${PKGINDEX_TOKEN:?PKGINDEX_TOKEN required (dispatch on $INDEX_REPO)}"
2929

3030
info() { echo "[bump] $*"; }
31-
WORK="$(mktemp -d)"; trap 'rm -rf "$WORK"' EXIT
3231

33-
info "cloning $INDEX_REPO"
34-
git clone -q --depth 20 "https://x-access-token:${TOKEN}@github.com/${INDEX_REPO}.git" "$WORK/idx"
35-
cd "$WORK/idx"
36-
git config user.email "ci@xlings.dev"
37-
git config user.name "xlings-ci"
38-
git checkout -q -B "$BRANCH"
32+
pr_url() { gh pr view "$BRANCH" -R "$INDEX_REPO" --json url --jq .url 2>/dev/null || true; }
3933

40-
info "version-check.py --apply --only $PROJ"
41-
# --workspace: version-check.py defaults its repo root to GITHUB_WORKSPACE,
42-
# which inside the RELEASE repo's runner is the release repo — not this
43-
# freshly-cloned index. Point it at the clone explicitly ("error: …/pkgs not
44-
# found" was this default kicking in; observed on the 0.0.83 release).
45-
python3 .github/scripts/version-check.py --workspace . --apply --only "$PROJ" > "$WORK/report.json" || {
46-
echo "[bump] version-check failed:" >&2; cat "$WORK/report.json" >&2 2>/dev/null || true; exit 1;
47-
}
48-
49-
if git diff --quiet; then
50-
info "no change — index already tracks the latest $PROJ; nothing to PR"
34+
if url="$(pr_url)" && [[ -n "$url" ]]; then
35+
info "PR already open: $url"
5136
exit 0
5237
fi
5338

54-
# Sanity: the resulting latest.ref should equal the released version. A
55-
# mismatch usually means GitHub's releases/latest hasn't caught up yet (API
56-
# lag) or a newer release exists — warn but still open the PR.
57-
GOT="$(grep -oE 'ref = "[^"]+"' pkgs/*/"${PROJ}".lua 2>/dev/null | head -1 | sed -E 's/.*"([^"]+)".*/\1/' || true)"
58-
if [[ -n "$GOT" && "$GOT" != "$VER" ]]; then
59-
echo "[bump] WARN: bumped latest.ref to '$GOT' but release version is '$VER' (upstream 'latest' differs?)"
60-
fi
61-
62-
git add -A
63-
git commit -qm "bump(${PROJ}): track ${VER} as latest
64-
65-
Auto-generated by the ${PROJ} release pipeline (bump_index.sh).
66-
Applied via version-check.py --apply --only ${PROJ}."
67-
68-
info "pushing $BRANCH (force — bot branch)"
69-
git push -q -f "https://x-access-token:${TOKEN}@github.com/${INDEX_REPO}.git" "$BRANCH"
70-
71-
# Open PR — idempotent: a force-push updates an already-open PR in place.
72-
export GH_TOKEN="$TOKEN"
73-
if gh pr view "$BRANCH" -R "$INDEX_REPO" >/dev/null 2>&1; then
74-
info "PR already open for $BRANCH (updated by force-push)"
75-
else
76-
gh pr create -R "$INDEX_REPO" --base main --head "$BRANCH" \
77-
--title "bump(${PROJ}): track ${VER} as latest" \
78-
--body "Automated by the ${PROJ} release pipeline. Bumps \`pkgs/*/${PROJ}.lua\` \`latest.ref\` to \`${VER}\` and appends the new version entry (via \`version-check.py --apply --only ${PROJ}\`).
79-
80-
Merge to publish into the official index — the index repo then republishes its artifact and gitee-sync mirrors the change. Binaries are already live on \`xlings-res/${PROJ}\` (GitHub + GitCode)."
81-
info "PR opened"
82-
fi
39+
info "dispatching xpkgindex-update.yml for xim:$PROJ"
40+
gh workflow run xpkgindex-update.yml -R "$INDEX_REPO" --ref main -f "package=xim:$PROJ"
41+
42+
deadline=$(( $(date +%s) + WAIT_S ))
43+
while (( $(date +%s) < deadline )); do
44+
sleep 30
45+
if url="$(pr_url)" && [[ -n "$url" ]]; then
46+
info "PR opened: $url"
47+
exit 0
48+
fi
49+
done
50+
51+
# BLOCKING: without the PR the index never learns the release exists. The
52+
# updater's run says why (a resource missing on one host, a policy refusal).
53+
echo "[bump] no $BRANCH after ${WAIT_S}s; see" \
54+
"https://github.com/$INDEX_REPO/actions/workflows/xpkgindex-update.yml" >&2
55+
exit 1

‎.github/workflows/release.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,8 @@ jobs:
969969
chmod +x .github/tools/bump_index.sh
970970
# A4: BLOCKING — a missing bump PR means the index never learns the
971971
# release exists and every post-release install of the new version 404s.
972+
# The index's own updater writes the PR (bump_index.sh says why);
973+
# it needs the GitCode mirror above to be complete.
972974
bash .github/tools/bump_index.sh mcpp "${{ steps.version.outputs.version }}"
973975
974976
# Post-release verification (ci-fresh-install) is triggered via its

0 commit comments

Comments
 (0)