Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/release-tag.json
Original file line number Diff line number Diff line change
@@ -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"
}
2 changes: 1 addition & 1 deletion .github/workflows/xpbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/xplabel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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 }}
GH_REPO: ${{ github.repository }}
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
2 changes: 1 addition & 1 deletion .github/workflows/xprelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/xpsync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/xptag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
66 changes: 66 additions & 0 deletions .github/xpsync-hook.sh
Original file line number Diff line number Diff line change
@@ -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"
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)$")
Expand Down