plasma-desktop/.forgejo/workflows/rebase.yml
Philip Peterson c2d011e63e quine branch: README and the rebase workflow
The fork's default branch, with no KDE code: how the quine-v<version>
branches work, and a daily workflow that carries our commits onto each
new Plasma 6 release as a new quine-v<version> branch, failing if a
commit doesn't apply cleanly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 04:30:18 -09:00

73 lines
3 KiB
YAML

# Carries our commits onto each new Plasma release: for every Plasma 6
# release tag newer than the newest quine-v* branch, makes quine-v<version>
# = the tag + our commits from that branch. Fails, making no branch, if a
# commit doesn't apply cleanly. See README.md.
name: rebase
on:
schedule:
# Between our Aurora build (05:00 UTC) and quine-linux's (07:00 UTC).
- cron: '0 6 * * *'
workflow_dispatch:
concurrency:
group: rebase
cancel-in-progress: false
jobs:
rebase:
runs-on: runner-x86-linux
env:
FORK: ${{ github.server_url }}/${{ github.repository }}.git
MIRROR: ${{ github.server_url }}/quine-global-labs/mirror-kde-plasma-desktop.git
steps:
- name: Make branches for new Plasma releases
env:
TOKEN: ${{ github.token }}
run: |
set -euo pipefail
git init -q work && cd work
git config user.name "Quine Linux CI"
git config user.email "ci@quinefoundation.com"
# The job token can push to this repo. Blob-less fetches: git
# fetches file contents from these remotes as cherry-picks need them.
git remote add origin "${FORK/https:\/\//https://ci:$TOKEN@}"
git remote add upstream "$MIRROR"
git fetch -q --filter=blob:none origin 'refs/heads/quine-v*:refs/remotes/origin/quine-v*'
git fetch -q --filter=blob:none upstream 'refs/tags/v6.*:refs/tags/v6.*'
# Newest branch we have, and release tags newer than it. Betas
# are x.y.80 and up.
newest=$(git for-each-ref --format='%(refname:lstrip=3)' 'refs/remotes/origin/quine-v*' |
sed 's/^quine-v//' | sort -V | tail -1)
[ -n "$newest" ] || { echo "no quine-v* branch to start from" >&2; exit 1; }
echo "newest branch: quine-v$newest"
new=$(git tag -l 'v6.*' | sed 's/^v//' |
grep -E '^6\.[0-9]+\.[0-9]+$' | awk -F. '$3 < 80' |
sort -V | awk -v n="$newest" '
BEGIN { split(n, b, ".") }
{ split($0, a, ".")
if (a[1] > b[1] || (a[1] == b[1] && (a[2] > b[2] || (a[2] == b[2] && a[3] > b[3])))) print }')
if [ -z "$new" ]; then
echo "no Plasma release newer than $newest"
exit 0
fi
base=$newest
for v in $new; do
echo "::group::quine-v$v"
git switch -q --detach "v$v"
commits=$(git rev-list --reverse "v$base..origin/quine-v$base")
for c in $commits; do
if ! git cherry-pick -x "$c" >/dev/null; then
git cherry-pick --abort || true
echo "::error::$(git log -1 --format='%h %s' "$c") doesn't apply to v$v; make quine-v$v by hand (README.md)"
exit 1
fi
done
git push -q origin "HEAD:refs/heads/quine-v$v" "refs/tags/v$v"
git update-ref "refs/remotes/origin/quine-v$v" HEAD
echo "made quine-v$v: v$v + $(echo "$commits" | wc -w) commit(s) from quine-v$base"
echo "::endgroup::"
base=$v
done