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
54 changes: 54 additions & 0 deletions .github/workflows/follow-stable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Follow stable

# Kernel.org point releases carry the urgent fixes, so SmoothKernel takes each
# one of its series as soon as it is published, with no manual step: every
# hour this checks kernel.org (scripts/follow-stable.sh), commits the new
# KERNEL_VERSION to main and starts the Release workflow on it. That run builds
# and attests the packages like any other commit to main; smoothapt ingests
# the release and every Smooth* system installs it through unattended-upgrades.
#
# A new series (7.2 -> 7.3) is only reported here: it needs the manual work in
# docs/bumping-kernel.md.
#
# Commits made with the workflow token do not start other workflows, which is
# why the release is started explicitly (workflow_dispatch is the exception).
on:
schedule:
- cron: '7 * * * *'
workflow_dispatch:

permissions:
contents: write # push the bump to main
actions: write # start the Release workflow

concurrency:
group: follow-stable
cancel-in-progress: false

jobs:
follow:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
ref: main

- name: Check kernel.org
id: bump
run: scripts/follow-stable.sh

- name: Commit and release
if: steps.bump.outputs.version != ''
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ steps.bump.outputs.version }}
run: |
set -euo pipefail
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
git commit -am "Update Linux to ${VERSION}" \
-m "Newest ${VERSION%.*} point release on kernel.org: https://cdn.kernel.org/pub/linux/kernel/v${VERSION%%.*}.x/ChangeLog-${VERSION}"
# Fails if main moved since the checkout; the next run retries.
git push origin HEAD:main
gh workflow run release.yml --ref main
echo "::notice title=SmoothKernel updated::Linux ${VERSION}; Release workflow started on main."
3 changes: 2 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ name: Release
# - pull_request to main: builds the same .deb set and uploads
# per-architecture workflow artifacts for review/testing.
# - tag push v*.*.*: publishes a stable release at that tag.
# - workflow_dispatch: manual run for ad-hoc rebuilds.
# - workflow_dispatch: manual run for ad-hoc rebuilds, and how the Follow
# stable workflow releases the kernel.org point release it commits.
#
# Every published .deb gets a GitHub build-provenance attestation, recorded in
# the public Sigstore transparency log. It ties the package's digest to this
Expand Down
16 changes: 15 additions & 1 deletion docs/bumping-kernel.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
# Bumping the kernel pin

The procedure when moving `linux-smoothkernel` to a newer kernel version. Applies to both major bumps (`6.x → 7.x`) and point bumps (`6.18.22 → 6.18.30`).
The procedure when moving `linux-smoothkernel` to a new kernel series (`7.2 → 7.3`, `6.x → 7.x`). Point releases within a series (`7.2.10 → 7.2.14`) are automatic; see below.

One kernel line across all four flavors, so one bump is a single coordinated edit — no per-flavor version skew.

## Point releases are automatic

A point release of the series SmoothKernel builds (`7.2.10 → 7.2.14`) needs no
one. The Follow stable workflow (`.github/workflows/follow-stable.yml`) checks
kernel.org every hour, commits the new `KERNEL_VERSION` to main and starts the
Release workflow. smoothapt ingests the release within the hour, and every
Smooth* system installs it through unattended-upgrades.
The patch lanes and configs carry over: lanes keep the name of the release
they were rebased on.

If a point release breaks a lane, that release's build fails and nothing is
published; fix the lane on main and the next build releases it. The steps
below are for a new series (`7.2 → 7.3`), which the workflow only reports.

## When to bump

Bump when the *latest stable kernel that the must-have DKMS set supports AND our vendored patch lanes are ready for* moves forward.
Expand Down
71 changes: 71 additions & 0 deletions scripts/follow-stable.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: AGPL-3.0-only
#
# follow-stable.sh: move KERNEL_VERSION to the newest kernel.org point release
# of the series SmoothKernel builds (7.2.10 -> 7.2.14, never 7.2 -> 7.3).
#
# Point releases of a series are bug and security fixes, and the patch lanes
# and configs carry over: the lanes keep the name of the release they were
# rebased on (cachyos-7.2.10 builds 7.2.14 too). A new series needs the manual
# work in docs/bumping-kernel.md (OpenZFS's Linux-Maximum, rebased lanes, a
# config refresh), so it is only reported.
#
# Prints the new version and writes version=<it> to $GITHUB_OUTPUT when it
# changed the env files; prints nothing when there is nothing to do.
#
# RELEASES_URL and CDN_URL can be overridden for testing.
set -euo pipefail

root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
releases_url="${RELEASES_URL:-https://www.kernel.org/releases.json}"
cdn_url="${CDN_URL:-https://cdn.kernel.org/pub/linux/kernel}"
env_files=("$root/examples/smooth.env" "$root/examples/smoothnas.env")

current="$(awk -F= '/^KERNEL_VERSION=/ {gsub(/[ \t]/,""); print $2; exit}' "${env_files[0]}")"
[[ "$current" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || {
echo "ERROR: KERNEL_VERSION in ${env_files[0]} is not x.y.z: '$current'" >&2
exit 1
}
series="${current%.*}"

releases="$(curl -fsSL "$releases_url")"
latest="$(jq -r --arg s "$series." '
[.releases[] | select(.moniker == "stable" or .moniker == "longterm")
| .version | select(startswith($s))] | first // empty' <<<"$releases")"
newest_stable="$(jq -r '[.releases[] | select(.moniker == "stable") | .version] | first // empty' <<<"$releases")"

newest_series="${newest_stable%.*}"
if [[ -n "$newest_stable" && "$newest_series" != "$series" ]] &&
[[ "$(printf '%s\n' "$series" "$newest_series" | sort -V | tail -1)" == "$newest_series" ]]; then
echo "::notice title=New kernel series::Linux $newest_stable is out; SmoothKernel stays on $series until it is moved by hand (docs/bumping-kernel.md)." >&2
fi

if [[ -z "$latest" ]]; then
echo "::warning title=Kernel series no longer maintained::kernel.org no longer lists Linux $series; move SmoothKernel to a maintained series by hand (docs/bumping-kernel.md)." >&2
exit 0
fi

if [[ "$latest" == "$current" ]] ||
[[ "$(printf '%s\n' "$current" "$latest" | sort -V | tail -1)" == "$current" ]]; then
echo "Linux $current is the newest $series release." >&2
exit 0
fi

# kernel.org lists a release as it is published; the build downloads the
# tarball and checks it against sha256sums.asc, so wait until both are there.
major="${latest%%.*}"
sums="$(curl -fsSL "$cdn_url/v${major}.x/sha256sums.asc" || true)"
if ! grep -qF " linux-$latest.tar.xz" <<<"$sums" ||
! curl -fsSLI -o /dev/null "$cdn_url/v${major}.x/linux-$latest.tar.xz"; then
echo "Linux $latest is listed but not yet on the CDN; trying again on the next run." >&2
exit 0
fi

for f in "${env_files[@]}"; do
sed -i "s/^KERNEL_VERSION=.*/KERNEL_VERSION=$latest/" "$f"
done
echo "Linux $current -> $latest" >&2
echo "$latest"
if [[ -n "${GITHUB_OUTPUT:-}" ]]; then
echo "version=$latest" >> "$GITHUB_OUTPUT"
fi
Loading