diff --git a/.github/scripts/release-changelog.sh b/.github/scripts/release-changelog.sh new file mode 100644 index 000000000..ef21cc66b --- /dev/null +++ b/.github/scripts/release-changelog.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# Move curated notes into the versioned section on a release-plz PR. +set -euo pipefail + +version=${1:?expected release version} +release_date=${2:?expected release date} +[[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)?$ ]] +[[ "$release_date" =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]] + +awk -v heading="## [$version]" -v date="$release_date" ' + { lines[NR] = $0 } + /^## \[Unreleased\]$/ { unreleased = NR; count++ } + index($0, heading) == 1 { released = 1 } + END { + if (!released && count != 1) { + print "Expected exactly one ## [Unreleased] heading" > "/dev/stderr" + exit 1 + } + for (i = 1; i <= NR; i++) { + print lines[i] + if (!released && i == unreleased) printf "\n%s - %s\n", heading, date + } + } +' diff --git a/.github/scripts/update-release-pr-changelog.sh b/.github/scripts/update-release-pr-changelog.sh new file mode 100644 index 000000000..4cd0f6502 --- /dev/null +++ b/.github/scripts/update-release-pr-changelog.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +set -euo pipefail + +pr=$(jq -er '.number' <<<"$RELEASE_PR") +version=$(jq -er '.releases[] | select(.package_name == "cipherstash-proxy") | .version' <<<"$RELEASE_PR") +branch=$(jq -er '.head_branch' <<<"$RELEASE_PR") +head=$(gh pr view "$pr" --repo "$GITHUB_REPOSITORY" --json headRefOid --jq .headRefOid) +tmp=$(mktemp -d) +trap 'rm -rf "$tmp"' EXIT +gh api "repos/$GITHUB_REPOSITORY/contents/Cargo.toml?ref=$head" --jq .content | + base64 --decode > "$tmp/Cargo.toml" +gh api "repos/$GITHUB_REPOSITORY/contents/CHANGELOG.md?ref=$head" --jq .content | + base64 --decode > "$tmp/original" +bash .github/scripts/release-changelog.sh "$version" "$(date -u +%F)" \ + < "$tmp/original" > "$tmp/CHANGELOG.md" +metadata="$PWD/.github/scripts/release-metadata.sh" +(cd "$tmp" && bash "$metadata" check "v$version") +if cmp -s "$tmp/original" "$tmp/CHANGELOG.md"; then + exit 0 +fi + +jq -n --arg repo "$GITHUB_REPOSITORY" --arg branch "$branch" \ + --arg head "$head" --arg version "$version" --rawfile changelog "$tmp/CHANGELOG.md" ' + { + query: "mutation($input: CreateCommitOnBranchInput!) { createCommitOnBranch(input: $input) { commit { oid } } }", + variables: {input: { + branch: {repositoryNameWithOwner: $repo, branchName: $branch}, + expectedHeadOid: $head, + message: {headline: ("docs(changelog): record Proxy " + $version + " release notes")}, + fileChanges: {additions: [{path: "CHANGELOG.md", contents: ($changelog | @base64)}]} + }} + } +' | gh api graphql --input - --jq '.data.createCommitOnBranch.commit.oid' diff --git a/.github/workflows/release-plz.yml b/.github/workflows/release-plz.yml index 3b4dcd1f3..36e89b965 100644 --- a/.github/workflows/release-plz.yml +++ b/.github/workflows/release-plz.yml @@ -45,9 +45,18 @@ jobs: # and commit through the API (no git push, so no persisted credentials), # and GitHub marks the commit Verified. - name: Run release-plz + id: release-plz uses: release-plz/action@8b5bf233ecb5779f63508db7cd050e948ee77cc2 # v0.5.144 with: command: release-pr version: 0.3.174 env: GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} + + # The GitHub App creates a verified commit without rewriting the branch. + - name: Version the curated changelog + if: steps.release-plz.outputs.prs_created == 'true' + env: + GH_TOKEN: ${{ steps.app-token.outputs.token }} + RELEASE_PR: ${{ steps.release-plz.outputs.pr }} + run: bash .github/scripts/update-release-pr-changelog.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c3e79c99..ddd6b4491 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). ## [Unreleased] +## [3.1.1] - 2026-12-04 + ### Changed - **Connection timeout log level**: `Database connection timeout` is now logged at `info` level instead of `warn`. diff --git a/Cargo.lock b/Cargo.lock index c289169ba..300627bdf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -839,7 +839,7 @@ dependencies = [ [[package]] name = "cipherstash-proxy" -version = "3.1.0" +version = "3.1.1" dependencies = [ "arc-swap", "async-trait", @@ -1635,7 +1635,7 @@ dependencies = [ [[package]] name = "eql-mapper-macros" -version = "3.1.0" +version = "3.1.1" dependencies = [ "pretty_assertions", "proc-macro2", @@ -4470,7 +4470,7 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "showcase" -version = "3.1.0" +version = "3.1.1" dependencies = [ "cipherstash-client", "cipherstash-config", diff --git a/Cargo.toml b/Cargo.toml index bcaa591ba..cd791d147 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "2" members = ["packages/*"] [workspace.package] -version = "3.1.0" +version = "3.1.1" edition = "2021" # Minimum supported Rust version (MSRV). CI builds the production binary on # exactly this toolchain. See "Supported Rust versions" in DEVELOPMENT.md diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 937cb7a8f..481547139 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -835,13 +835,12 @@ To use it: 1. Check the proposed version. If it's wrong, for example because a breaking change wasn't marked `feat!:`, edit the version in the PR. -2. In `CHANGELOG.md`, rename `## [Unreleased]` to `## [X.Y.Z] - `, and add a new empty `## [Unreleased]` above it. - Make your edits (this one and any version change) the last commits before merging. - If `main` moves after a person has committed to the PR, release-plz closes it and opens a fresh one without those edits, so check the version again before approving. +2. Check the dated release section in `CHANGELOG.md`. + The workflow moves the curated `Unreleased` notes under the version heading whenever release-plz generates the PR. 3. Approve and merge in one sitting. release-plz rebuilds the PR whenever `main` moves, and `main` keeps approvals, so an older approval can cover changes you haven't seen. -release-plz never generates changelog entries for Proxy, and the configuration is explained in [ADR 0001](docs/adr/0001-release-plz-release-pr.md). +See [ADR 0001](docs/adr/0001-release-plz-release-pr.md) for the configuration. To prepare a release by hand instead (always the case on `release/2.2`), open a PR that: 1. Bumps `version` under `[workspace.package]` in the root `Cargo.toml` (and runs diff --git a/docs/adr/0001-release-plz-release-pr.md b/docs/adr/0001-release-plz-release-pr.md index 2a404c38f..0c15ff671 100644 --- a/docs/adr/0001-release-plz-release-pr.md +++ b/docs/adr/0001-release-plz-release-pr.md @@ -35,7 +35,8 @@ Run release-plz on every push to main, in `.github/workflows/release-plz.yml`, c - **Only `cipherstash-proxy` is released.** Workspace members that inherit `version.workspace` move with it. - **No semver checks.** `semver_check = false`, because Proxy's library target is internal and checking it would turn refactors into major version bumps. - **Hand-written changelog.** `changelog_update = false`. - A person renames `## [Unreleased]` to `## [X.Y.Z] - ` in the release PR, and the `Release metadata` check fails any PR that changes the version without that heading. + After release-plz creates or updates the PR, the workflow adds the dated version heading above the curated notes and commits it using the GitHub App. + The `Release metadata` check still requires that heading on any version bump. - **Release only from the release PR.** `release_always = false`. - **Tag format `vX.Y.Z`**, matching every existing tag, `release.yml` and the Docker tags. - **GitHub App token.** The workflow mints a token from a GitHub App so the release PR runs `test.yml` and, once releases are automated, publishing a release starts `release.yml`. @@ -69,6 +70,6 @@ The release step will create the signed tag and the GitHub release when a releas - Approving the release PR approves shipping main as it is at that moment. Main keeps approvals when new commits land, and release-plz rebuilds the PR whenever main moves, so approve and merge in one sitting. -- When a person commits to the release PR (the changelog rename), release-plz closes it and opens a fresh one on the next push to main, so make that edit last. +- Keep curated notes on main so the workflow can carry them into every regenerated release PR. - Switching on `changelog_update` to match other repositories would put generated entries beside the curated notes, so keep it off. - If the App or its installation is removed, release PRs stop running CI and releases stop publishing Docker images, without any error from release-plz itself. diff --git a/release-plz.toml b/release-plz.toml index e487632c3..27b3acc01 100644 --- a/release-plz.toml +++ b/release-plz.toml @@ -11,8 +11,7 @@ release = false # When the release job runs, release only if a release-plz release PR has # just merged, never on other pushes to main. release_always = false -# CHANGELOG.md is written by hand. A person renames `## [Unreleased]` in the -# release PR; the "Release metadata" check fails the PR until they do. +# Keep human-written notes. The workflow versions them on the release PR. changelog_update = false # Existing tags, release.yml and the Docker tags all use vX.Y.Z. git_tag_name = "v{{ version }}"