From b0f75fd7dc105eb3e48d552d1a5862b1d1cd7d40 Mon Sep 17 00:00:00 2001 From: Adam Chrapkowski Date: Wed, 25 Nov 2026 12:33:49 +0100 Subject: [PATCH 1/2] Release a patch version every 4 weeks scip-rust ships as a Docker image built from flake.lock, so it needs regular releases to pick up the nixpkgs updates from lock file maintenance even when the code doesn't change. A scheduled workflow runs every Monday and, every 4 weeks after 2026-11-23, starts the release workflow with the next patch version if the image inputs changed since the last published release. Since nobody reviews these releases, the release workflow now only tags a commit that passed CI. --- .github/workflows/release.yml | 13 ++++++ .github/workflows/scheduled-release.yml | 60 +++++++++++++++++++++++++ README.md | 9 +++- 3 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/scheduled-release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9e19fb6..2bb0689 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,6 +12,7 @@ jobs: tag: runs-on: ubuntu-latest permissions: + checks: read contents: write steps: - uses: actions/checkout@v7 @@ -27,6 +28,18 @@ jobs: exit 1 fi + - name: Check that CI passed on the commit to tag + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + SHA="$(git rev-parse HEAD)" + CI="$(gh api "repos/$GITHUB_REPOSITORY/commits/$SHA/check-runs?check_name=ci-pass" \ + --jq '.check_runs[0].conclusion // "pending"')" + if [ "$CI" != "success" ]; then + echo "::error::ci-pass is $CI on $SHA; re-run this job once CI passes." + exit 1 + fi + - name: Create and push tag env: NEW_VERSION: ${{ inputs.version }} diff --git a/.github/workflows/scheduled-release.yml b/.github/workflows/scheduled-release.yml new file mode 100644 index 0000000..ee74c70 --- /dev/null +++ b/.github/workflows/scheduled-release.yml @@ -0,0 +1,60 @@ +name: scheduled-release + +# Releases the next patch version every 4 weeks on Monday, even without code +# changes, so the image picks up the nixpkgs updates that Renovate's lock file +# maintenance merged since the last release. +on: + # Cron can't express "every 4 weeks", so this runs every Monday + # and skips weeks that aren't a multiple of 4 after RELEASE_MONDAY. + schedule: + - cron: "0 9 * * 1" + workflow_dispatch: + +env: + RELEASE_MONDAY: "2026-11-23" + +permissions: + actions: write + contents: read + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + with: + # Release from main even when dispatched from another branch. + ref: main + fetch-depth: 0 + + - name: Start release + env: + GH_TOKEN: ${{ github.token }} + run: | + set -euo pipefail + if [ "$GITHUB_EVENT_NAME" = "schedule" ]; then + # Unlike the clock, the run's creation time stays the same when + # the run is re-run on a later day. + CREATED="$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" --jq .created_at)" + DAYS=$(( ($(date -u -d "$CREATED" +%s) - $(date -u -d "$RELEASE_MONDAY" +%s)) / 86400 )) + if (( DAYS % 28 != 0 )); then + echo "Not a release week ($DAYS days after $RELEASE_MONDAY)" + exit 0 + fi + # The image is built from these files alone, so it would be identical. + # Compare with the last published release rather than the last tag, + # because release.yml pushes the tag before it publishes anything. + PUBLISHED="$(gh release view -R "$GITHUB_REPOSITORY" --json tagName --jq .tagName)" + if git diff --quiet "$PUBLISHED" HEAD -- flake.nix flake.lock scip-rust; then + echo "Nothing in the image changed since $PUBLISHED" + exit 0 + fi + fi + + LAST_TAG="$(git tag --list 'v*' | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | tail -n 1)" + IFS=. read -r MAJOR MINOR PATCH <<<"${LAST_TAG#v}" + VERSION="$MAJOR.$MINOR.$((PATCH + 1))" + # Workflows can start workflow_dispatch runs with GITHUB_TOKEN. + # release.yml checks CI on the commit it tags. + gh workflow run release.yml -R "$GITHUB_REPOSITORY" --ref main -f version="$VERSION" + echo "Started the release of v$VERSION" diff --git a/README.md b/README.md index e6929d4..80d5412 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,15 @@ nix run github:scip-code/scip-rust ## Cutting releases From the `main` branch, trigger the [release workflow] via **Actions → release → -Run workflow**, entering `M.N.P` as the version. +Run workflow**, entering `M.N.P` as the version. It only releases a commit that +passed CI. + +Every 4 weeks on Monday, the [scheduled release workflow] releases the next patch +version if the image changed since the last release, for example because +Renovate's lock file maintenance updated nixpkgs. Running it manually releases +the next patch version right away. [`rust-analyzer`]: https://rust-analyzer.github.io/book/installation.html [`scip-rust`]: ./scip-rust [release workflow]: https://github.com/scip-code/scip-rust/actions/workflows/release.yml + [scheduled release workflow]: https://github.com/scip-code/scip-rust/actions/workflows/scheduled-release.yml From 50d6d2eb2bccb9c6778819ec8caa94577c97c883 Mon Sep 17 00:00:00 2001 From: Adam Chrapkowski Date: Wed, 25 Nov 2026 12:38:11 +0100 Subject: [PATCH 2/2] Auto-merge passing non-major Renovate updates Renovate merged every update on its own, including major GitHub Actions bumps, while lock file maintenance waited for a manual merge even though it is how the image picks up nixpkgs security fixes. Minor, patch and digest updates and lock file maintenance now merge once ci-pass passes, which builds the image and indexes four projects with it. CI now builds and tests the image on arm64 too, since release.yml publishes both architectures. Major GitHub Actions updates and NixOS release upgrades need a manual merge, since release.yml's actions don't run in CI and a new NixOS release swaps the whole toolchain. Updates to the CI test projects merge regardless of type, because CI indexes the new version. GitHub Actions and the CI test projects are grouped into one PR each, and Renovate runs on Monday mornings (Europe/Warsaw). The custom manager uses managerFilePatterns, which replaced fileMatch. --- .github/renovate.json | 26 ++++++++++++++++++++++---- .github/workflows/ci.yaml | 8 +++++++- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/.github/renovate.json b/.github/renovate.json index cbe6a20..20122d0 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -1,19 +1,20 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", "extends": ["config:recommended"], - "automerge": true, + "timezone": "Europe/Warsaw", + "schedule": ["before 9am on monday"], "nix": { "enabled": true }, "lockFileMaintenance": { "enabled": true, "schedule": ["* 0-3 * * 1"], - "automerge": false + "automerge": true }, "customManagers": [ { "customType": "regex", - "fileMatch": ["^\\.github/workflows/ci\\.yaml$"], + "managerFilePatterns": ["/^\\.github/workflows/ci\\.yaml$/"], "matchStrings": [ "(?:repo|repository): (?[^\\s${]+)\\s+ref: (?[^\\s${]+)" ], @@ -21,10 +22,27 @@ } ], "packageRules": [ + { + "matchUpdateTypes": ["minor", "patch", "digest", "pin", "pinDigest"], + "automerge": true + }, + { + "description": "NixOS release upgrades, such as nixos-26.05 to nixos-26.11, need a manual merge however Renovate classifies them.", + "matchManagers": ["nix"], + "matchDepNames": ["nixpkgs"], + "matchUpdateTypes": ["major", "minor"], + "automerge": false + }, + { + "matchManagers": ["github-actions"], + "groupName": "GitHub Actions" + }, { "matchManagers": ["custom.regex"], "matchFileNames": [".github/workflows/ci.yaml"], - "schedule": ["* * 1 */3 *"] + "groupName": "CI test projects", + "schedule": ["* * 1 */3 *"], + "automerge": true } ] } diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1b25999..97be906 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -20,8 +20,14 @@ jobs: - uses: DeterminateSystems/magic-nix-cache-action@v15 - run: nix flake check + # Both architectures that release.yml publishes, so that auto-merged + # updates can't break the arm64 image unnoticed. docker: - runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + runner: [ubuntu-latest, ubuntu-24.04-arm] + runs-on: ${{ matrix.runner }} timeout-minutes: 30 steps: - uses: actions/checkout@v7