From e04a828a185c6c05d5d8657a053442ac1234dfb3 Mon Sep 17 00:00:00 2001 From: Scott M Anderson Date: Thu, 26 Nov 2026 04:01:08 -0700 Subject: [PATCH 1/5] automate upstream CMake release bumps via xpsync hook MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - .github/xpsync-hook.sh: checks Kitware/CMake releases, bumps the VERSION/RC/URL/sha lines in CMakeLists.txt, regenerates release-tag.json, and commits "cmake repackage .tar.gz as .rpm" on the xpsync branch — token-free and idempotent - .github/workflows/xplabel.yml: adds release:tag to xpsync-* PRs whose CMakeLists.txt diff touches version lines (previously done by hand so a merge produces the xpv tag) - .github/workflows/xpsync.yml: synced template update — hook job plus push/schedule triggers issue https://github.com/externpro/cmake-pkg/issues/30 --- .github/workflows/xplabel.yml | 29 +++++++++++++++ .github/workflows/xpsync.yml | 62 ++++++++++++++++++++++++++++++++ .github/xpsync-hook.sh | 66 +++++++++++++++++++++++++++++++++++ 3 files changed, 157 insertions(+) create mode 100644 .github/workflows/xplabel.yml create mode 100644 .github/xpsync-hook.sh diff --git a/.github/workflows/xplabel.yml b/.github/workflows/xplabel.yml new file mode 100644 index 0000000..518425c --- /dev/null +++ b/.github/workflows/xplabel.yml @@ -0,0 +1,29 @@ +name: xpLabel +permissions: + pull-requests: write + issues: write +on: + pull_request: + types: [opened, reopened, synchronize] + branches: ["xpro"] +jobs: + release-tag: + if: startsWith(github.event.pull_request.head.ref, 'xpsync-') + runs-on: ubuntu-latest + steps: + - name: Label sync PRs that bump the upstream version + env: + GH_TOKEN: ${{ github.token }} + PR: ${{ github.event.pull_request.number }} + shell: bash + run: | + set -euo pipefail + gh label create release:tag --color 0e8a16 --description "create xpv tag on merge" 2>/dev/null || true + gh pr diff "${PR}" --patch > /tmp/pr.diff || gh pr diff "${PR}" > /tmp/pr.diff + sed -n '/^diff --git a\/CMakeLists.txt/,/^diff --git /p' /tmp/pr.diff > /tmp/win.diff + if grep -qE '^\+(project\(cmake-pkg VERSION|set\(RC|set\(sha_)' /tmp/win.diff; then + gh pr edit "${PR}" --add-label release:tag + echo "added release:tag to PR #${PR} (upstream version bump detected)" + else + echo "no upstream version bump in PR #${PR}; not labeling" + fi diff --git a/.github/workflows/xpsync.yml b/.github/workflows/xpsync.yml index 5d890f3..dd3a648 100644 --- a/.github/workflows/xpsync.yml +++ b/.github/workflows/xpsync.yml @@ -5,8 +5,70 @@ permissions: packages: write on: workflow_dispatch: + push: + branches: ["xpsync"] + schedule: + - cron: '37 5 * * *' +concurrency: + group: xpsync jobs: + hook: + # runs the repo's .github/xpsync-hook.sh (if present) on every trigger — + # keeps the contract simple: hooks must be cheap and idempotent. + # Only scheduled runs are gated on hook work; push and dispatch proceed + # to the full sync regardless (see sync job's if). + permissions: + contents: write + outputs: + work: ${{ steps.gate.outputs.work }} + runs-on: ubuntu-latest + steps: + - + name: Checkout repository + uses: actions/checkout@v6 + with: + fetch-depth: 0 + - + name: Run xpsync-hook and gate sync + id: gate + shell: bash + env: + GH_TOKEN: ${{ github.token }} + run: | + set -euo pipefail + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git checkout -B xpsync origin/xpsync 2>/dev/null || git checkout -B xpsync + if [ -f .github/xpsync-hook.sh ]; then + bash .github/xpsync-hook.sh + else + echo "no .github/xpsync-hook.sh found" + fi + BASE="origin/${{ github.event.repository.default_branch }}" + work=false + if [ "$(git rev-list --count "${BASE}..HEAD")" -gt 0 ]; then + work=true + # skip the churn if an open xpsync PR already carries these commits + while read -r head; do + [ -n "${head}" ] || continue + git fetch --depth 1 origin "${head}" 2>/dev/null || continue + if [ "$(git rev-list --count FETCH_HEAD..HEAD)" -eq 0 ]; then + echo "open PR branch ${head} already contains this work" + work=false + break + fi + done < <(gh pr list --state open --json headRefName \ + --jq '.[].headRefName | select(startswith("xpsync-"))') + fi + echo "work=${work}" >> "$GITHUB_OUTPUT" + if [ "${work}" = "true" ]; then + # github.token credentials — this push does not retrigger the + # on.push workflow (events from GITHUB_TOKEN don't run workflows) + git push origin "HEAD:xpsync" + fi sync: + needs: hook + if: ${{ always() && (github.event_name != 'schedule' || needs.hook.outputs.work == 'true') }} uses: externpro/externpro/.github/workflows/sync-externpro.yml@main secrets: automation_token: ${{ secrets.XPRO_TOKEN }} diff --git a/.github/xpsync-hook.sh b/.github/xpsync-hook.sh new file mode 100644 index 0000000..7742bab --- /dev/null +++ b/.github/xpsync-hook.sh @@ -0,0 +1,66 @@ +#!/usr/bin/env bash +# xpsync hook — bump CMakeLists.txt to the newest upstream Kitware/CMake release. +# Invoked by the xpsync "hook" job on the `xpsync` branch. Make commits for any +# work; the workflow pushes the branch and the sync opens a PR when the branch +# ends up ahead of the default branch. Must stay cheap and idempotent — it runs +# on every xpsync trigger (schedule, push to xpsync, workflow_dispatch). +# Keep it token-free: unauthenticated GitHub API is fine for a daily check. +set -euo pipefail +UPSTREAM=Kitware/CMake + +cur_base=$(awk '/^project\(cmake-pkg VERSION/ {print $3; exit}' CMakeLists.txt) +cur_rc=$(awk '/^set\(RC/ {if (match($0, /"[^"]*"/)) print substr($0, RSTART+1, RLENGTH-2); exit}' CMakeLists.txt) +[[ -n "${cur_base}" ]] || { echo "::error::could not parse project VERSION"; exit 1; } +cur="${cur_base}${cur_rc}" +echo "current: ${cur}" + +cat > /tmp/vkey.py <<'PY' +import re, sys +def key(t): + m = re.match(r'v?(\d+)\.(\d+)\.(\d+)(?:-rc(\d+))?$', t.strip()) + if not m: return (-1, 0, 0, 0, 0) + a, b, c, rc = m.groups() + return (int(a), int(b), int(c), 0 if rc else 1, int(rc or 0)) +if sys.argv[1] == 'max': + print(max((l.strip() for l in sys.stdin if l.strip()), key=key)) +else: # 'newer' NEW OLD: exit 0 if NEW > OLD + sys.exit(0 if key(sys.argv[2]) > key(sys.argv[3]) else 1) +PY + +latest=$(curl -fsSL "https://api.github.com/repos/${UPSTREAM}/releases" \ + | python3 -c "import json,sys; print('\n'.join(r['tag_name'] for r in json.load(sys.stdin)))" \ + | python3 /tmp/vkey.py max) +echo "upstream latest: ${latest}" +python3 /tmp/vkey.py newer "${latest}" "v${cur}" || { echo "already up to date"; exit 0; } + +new="${latest#v}" # e.g. 4.6.0 or 4.6.0-rc1 +base="${new%%-rc*}" # e.g. 4.6.0 +rc="${new#"${base}"}" # e.g. -rc1 or empty + +if git log -n 30 --format=%s | grep -qx "cmake ${new} repackage .tar.gz as .rpm"; then + echo "bump to ${new} already committed on this branch"; exit 0 +fi + +sums=$(curl -fsSL "https://github.com/${UPSTREAM}/releases/download/${latest}/cmake-${new}-SHA-256.txt") +sha_aarch64=$(awk -v f="cmake-${new}-linux-aarch64.tar.gz" '$2 == f {print $1}' <<<"${sums}") +sha_x86_64=$(awk -v f="cmake-${new}-linux-x86_64.tar.gz" '$2 == f {print $1}' <<<"${sums}") +[[ "${sha_aarch64}" =~ ^[0-9a-f]{64}$ && "${sha_x86_64}" =~ ^[0-9a-f]{64}$ ]] || { + echo "::error::could not extract SHA-256 sums for ${new}"; exit 1; } + +sed -i -E \ + -e "s|^project.cmake-pkg VERSION [0-9.]+|project(cmake-pkg VERSION ${base}|" \ + -e "s|^set.RC \".*\".|set(RC \"${rc}\")|" \ + -e "s|^# https://github.com/Kitware/CMake/releases/tag/.*|# https://github.com/Kitware/CMake/releases/tag/v${new}|" \ + -e "s|^# https://github.com/Kitware/CMake/releases/download/.*linux-aarch64.*|# https://github.com/Kitware/CMake/releases/download/v${new}/cmake-${new}-linux-aarch64.tar.gz|" \ + -e "s|^# https://github.com/Kitware/CMake/releases/download/.*linux-x86_64.*|# https://github.com/Kitware/CMake/releases/download/v${new}/cmake-${new}-linux-x86_64.tar.gz|" \ + -e "s|^set.sha_aarch64 [0-9a-f]+.|set(sha_aarch64 ${sha_aarch64})|" \ + -e "s|^set.sha_x86_64 [0-9a-f]+.|set(sha_x86_64 ${sha_x86_64})|" \ + CMakeLists.txt +git diff --check +git diff --quiet && { echo "::error::no changes produced"; exit 1; } + +if [[ -n "${rc}" ]]; then xptag="xpv${new}"; else xptag="xpv${new}.1"; fi +printf '{\n "message": "xpro version %s tag",\n "tag": "%s"\n}\n' "${xptag#xpv}" "${xptag}" > .github/release-tag.json + +git add CMakeLists.txt .github/release-tag.json +git commit -m "cmake ${new} repackage .tar.gz as .rpm" From 9f1df4ed108bad05b07d3a8bde7006479c07494a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 26 Nov 2026 11:02:29 +0000 Subject: [PATCH 2/5] cmake 4.5.1 repackage .tar.gz as .rpm --- .github/release-tag.json | 4 ++-- CMakeLists.txt | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/release-tag.json b/.github/release-tag.json index 381f5d8..71bf6cd 100644 --- a/.github/release-tag.json +++ b/.github/release-tag.json @@ -1,4 +1,4 @@ { - "message": "xpro version 4.5.0.1 tag", - "tag": "xpv4.5.0.1" + "message": "xpro version 4.5.1.1 tag", + "tag": "xpv4.5.1.1" } diff --git a/CMakeLists.txt b/CMakeLists.txt index 11b22f2..80eecbb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,12 +1,12 @@ cmake_minimum_required(VERSION 4.4) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build configuration") -project(cmake-pkg VERSION 4.5.0 LANGUAGES CXX) +project(cmake-pkg VERSION 4.5.1 LANGUAGES CXX) set(RC "") -# https://github.com/Kitware/CMake/releases/tag/v4.5.0 -# https://github.com/Kitware/CMake/releases/download/v4.5.0/cmake-4.5.0-linux-aarch64.tar.gz -# https://github.com/Kitware/CMake/releases/download/v4.5.0/cmake-4.5.0-linux-x86_64.tar.gz -set(sha_aarch64 0c8447e7bba9701467b5ac6155d157aa9e309e71af4981f78bd4b9176107f553) -set(sha_x86_64 81f0d5b0960fb6adc8197030ffc827fba937640d51e73e39e0e9e40d88c66f6f) +# https://github.com/Kitware/CMake/releases/tag/v4.5.1 +# https://github.com/Kitware/CMake/releases/download/v4.5.1/cmake-4.5.1-linux-aarch64.tar.gz +# https://github.com/Kitware/CMake/releases/download/v4.5.1/cmake-4.5.1-linux-x86_64.tar.gz +set(sha_aarch64 3bec208f11ed96c173032eeaf97937c54dd246acefee22acd7794a6b4e70d536) +set(sha_x86_64 83b71181fb62b4fe8f26067a9321448572e7a43bd04ff6c7f54a24c33698f16d) set(REPO https://github.com/Kitware/CMake) string(TOLOWER ${CMAKE_SYSTEM_NAME} os) if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|amd64|AMD64)$") From f575fb27722ad360ace0c9b2738b4e4cdbd16b5b Mon Sep 17 00:00:00 2001 From: Scott M Anderson Date: Thu, 26 Nov 2026 04:26:09 -0700 Subject: [PATCH 3/5] workflows/xplabel: set GH_REPO so gh works without a checkout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gh resolves the repo from the local git remote; with no actions/checkout it fails with "fatal: not a git repository" — GH_REPO supplies the repo context instead issue https://github.com/externpro/cmake-pkg/issues/30 --- .github/workflows/xplabel.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/xplabel.yml b/.github/workflows/xplabel.yml index 518425c..f0e0cd8 100644 --- a/.github/workflows/xplabel.yml +++ b/.github/workflows/xplabel.yml @@ -14,6 +14,7 @@ jobs: - name: Label sync PRs that bump the upstream version env: GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} PR: ${{ github.event.pull_request.number }} shell: bash run: | From a1ea60569e4b75741dbae75378c60f065e9d4fcb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 26 Nov 2026 11:27:36 +0000 Subject: [PATCH 4/5] externpro 26.02.6-3-g483ab21 --- .externpro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.externpro b/.externpro index 15fac0a..483ab21 160000 --- a/.externpro +++ b/.externpro @@ -1 +1 @@ -Subproject commit 15fac0a88bc3a8a89023c2c31b34a16e0df4d1d7 +Subproject commit 483ab218ae69b59335cb25f3938b9d0b77c79755 From 7b0e994b15a433f01f9af09f26c8a53eaa2be09e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 26 Nov 2026 11:27:36 +0000 Subject: [PATCH 5/5] sync GitHub Actions workflows --- .github/workflows/xpbuild.yml | 2 +- .github/workflows/xprelease.yml | 2 +- .github/workflows/xptag.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/xpbuild.yml b/.github/workflows/xpbuild.yml index ee8598a..3e20df2 100644 --- a/.github/workflows/xpbuild.yml +++ b/.github/workflows/xpbuild.yml @@ -14,7 +14,7 @@ jobs: contents: read pull-requests: write packages: write - uses: externpro/externpro/.github/workflows/build-linux.yml@26.02.5 + uses: externpro/externpro/.github/workflows/build-linux.yml@26.02.6 secrets: automation_token: ${{ secrets.GHCR_TOKEN }} with: diff --git a/.github/workflows/xprelease.yml b/.github/workflows/xprelease.yml index 41c8573..f3842a6 100644 --- a/.github/workflows/xprelease.yml +++ b/.github/workflows/xprelease.yml @@ -34,7 +34,7 @@ jobs: # Upload build artifacts as release assets release-from-build: if: github.event_name == 'workflow_dispatch' - uses: externpro/externpro/.github/workflows/release-from-build.yml@26.02.5 + uses: externpro/externpro/.github/workflows/release-from-build.yml@26.02.6 with: workflow_run_url: ${{ github.event.inputs.workflow_run_url }} artifact_pattern: '*.rpm' diff --git a/.github/workflows/xptag.yml b/.github/workflows/xptag.yml index 1d9db4f..b8e3aab 100644 --- a/.github/workflows/xptag.yml +++ b/.github/workflows/xptag.yml @@ -8,7 +8,7 @@ on: jobs: tag: if: ${{ github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'xpro' && contains(github.event.pull_request.labels.*.name, 'release:tag') }} - uses: externpro/externpro/.github/workflows/tag-release.yml@26.02.5 + uses: externpro/externpro/.github/workflows/tag-release.yml@26.02.6 with: merge_sha: ${{ github.event.pull_request.merge_commit_sha }} pr_number: ${{ github.event.pull_request.number }}