Skip to content
Open
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
26 changes: 22 additions & 4 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,48 @@
{
"$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): (?<depName>[^\\s${]+)\\s+ref: (?<currentValue>[^\\s${]+)"
],
"datasourceTemplate": "github-releases"
}
],
"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
}
]
}
8 changes: 7 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
tag:
runs-on: ubuntu-latest
permissions:
checks: read
contents: write
steps:
- uses: actions/checkout@v7
Expand All @@ -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 }}
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/scheduled-release.yml
Original file line number Diff line number Diff line change
@@ -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"
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading