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
24 changes: 24 additions & 0 deletions .github/scripts/release-changelog.sh
Original file line number Diff line number Diff line change
@@ -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
}
}
'
33 changes: 33 additions & 0 deletions .github/scripts/update-release-pr-changelog.sh
Original file line number Diff line number Diff line change
@@ -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'
9 changes: 9 additions & 0 deletions .github/workflows/release-plz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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] - <release date>`, 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
Expand Down
5 changes: 3 additions & 2 deletions docs/adr/0001-release-plz-release-pr.md
Original file line number Diff line number Diff line change
Expand Up @@ -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] - <date>` 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`.
Expand Down Expand Up @@ -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.
3 changes: 1 addition & 2 deletions release-plz.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down
Loading