diff --git a/.craft.yml b/.craft.yml new file mode 100644 index 00000000..2948d9c9 --- /dev/null +++ b/.craft.yml @@ -0,0 +1,63 @@ +minVersion: 3.3.0 + +# Each workspace is released on its own, with its own version, tags, release +# branch and changelog. Pick one with `--workspace ` or `CRAFT_WORKSPACE`. +# +# A workspace's changelog lists every PR that changes its directory or one of +# its `includePaths`. Files outside all workspaces (root config, CI, docs, ...) +# are excluded everywhere. Entries are grouped by the categories in +# `.github/release.yml`, which all workspaces share. +workspaces: + clients/python: + releaseBranchPrefix: release-py + preReleaseCommand: scripts/bump-version-py-client.sh + changelog: + policy: auto + scopeGrouping: false + unownedPaths: exclude + targets: + - name: github + tagPrefix: py-client@ + - name: pypi + - name: sentry-pypi + internalPypiRepo: getsentry/pypi + requireNames: + - /.*objectstore_client.*whl$/ + - /.*objectstore_client.*tar\.gz$/ + + clients/rust: + releaseBranchPrefix: release-rust + preReleaseCommand: scripts/bump-version-rs-client.sh + changelog: + policy: auto + scopeGrouping: false + unownedPaths: exclude + # The crates target publishes from source, so there are no build artifacts. + artifactProvider: + name: none + targets: + - name: github + tagPrefix: rs-client@ + - name: crates + + objectstore-server: + releaseBranchPrefix: release + preReleaseCommand: scripts/bump-version-server.sh + versioning: + policy: calver + changelog: + policy: auto + scopeGrouping: false + unownedPaths: exclude + # The server crate and the storage service, which hold nearly all + # server behavior. Changes to the other crates the server is built from + # aren't listed. + includePaths: + - objectstore-service + artifactProvider: + name: none + targets: + - name: github + # Without a prefix, Craft would take the nearest client tag as the + # previous server release and start the changelog there. + tagPrefix: server@ diff --git a/clients/python/.github/release.yml b/.github/release.yml similarity index 89% rename from clients/python/.github/release.yml rename to .github/release.yml index 23b3d0bd..b4c0f22c 100644 --- a/clients/python/.github/release.yml +++ b/.github/release.yml @@ -1,5 +1,4 @@ -# Changelog categories for this client. Keep in sync with the other client's -# `.github/release.yml`. +# Changelog categories for every Craft workspace in `.craft.yml`. # # A custom file replaces Craft's defaults entirely. It groups entries by change # type, strips the `type(scope):` prefix, and catches every remaining change so diff --git a/.github/workflows/changelog-preview-python.yml b/.github/workflows/changelog-preview-python.yml deleted file mode 100644 index 5798a85e..00000000 --- a/.github/workflows/changelog-preview-python.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Changelog Preview (Python client) - -on: - pull_request_target: - types: [opened, synchronize, reopened, edited, labeled, unlabeled] - paths: - - clients/python/** - -permissions: - contents: read - pull-requests: write - statuses: write - -jobs: - changelog-preview: - uses: getsentry/craft/.github/workflows/changelog-preview.yml@924b450ede4af30e30de4821a4b357d676c8df92 # v3 - with: - working-directory: clients/python - # Report as a check with a job summary. In comment mode, both client - # previews would overwrite the same PR comment. - comment: false diff --git a/.github/workflows/changelog-preview-rust.yml b/.github/workflows/changelog-preview-rust.yml deleted file mode 100644 index c71b94bc..00000000 --- a/.github/workflows/changelog-preview-rust.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Changelog Preview (Rust client) - -on: - pull_request_target: - types: [opened, synchronize, reopened, edited, labeled, unlabeled] - paths: - - clients/rust/** - -permissions: - contents: read - pull-requests: write - statuses: write - -jobs: - changelog-preview: - uses: getsentry/craft/.github/workflows/changelog-preview.yml@924b450ede4af30e30de4821a4b357d676c8df92 # v3 - with: - working-directory: clients/rust - # Report as a check with a job summary. In comment mode, both client - # previews would overwrite the same PR comment. - comment: false diff --git a/.github/workflows/changelog-preview.yml b/.github/workflows/changelog-preview.yml new file mode 100644 index 00000000..314173ae --- /dev/null +++ b/.github/workflows/changelog-preview.yml @@ -0,0 +1,17 @@ +name: Changelog Preview + +on: + pull_request_target: + types: [opened, synchronize, reopened, edited, labeled, unlabeled] + +permissions: + contents: read + pull-requests: write + +jobs: + changelog-preview: + # Posts one comment listing every workspace in `.craft.yml` whose + # changelog lists this PR, with its bump. + uses: getsentry/craft/.github/workflows/changelog-preview.yml@4a8dba2a45b09f4e3fcfc86a79c94d0dd93295bb # 3.4.0 + with: + craft-version: 3.4.0 diff --git a/.github/workflows/release-clients.yml b/.github/workflows/release.yml similarity index 65% rename from .github/workflows/release-clients.yml rename to .github/workflows/release.yml index b985e0cf..3382355d 100644 --- a/.github/workflows/release-clients.yml +++ b/.github/workflows/release.yml @@ -1,18 +1,19 @@ -name: Release client library +name: Release on: workflow_dispatch: inputs: - client: - description: Client to release + workspace: + description: Craft workspace to release required: true type: choice options: - - python - - rust + - clients/python + - clients/rust + - objectstore-server version: - description: Version to release - required: true + description: Exact version, bump type (major, minor, patch), or auto. Leave blank for auto (clients) or CalVer (server) + required: false force: description: Force a release even when there are release-blockers (optional) required: false @@ -41,11 +42,11 @@ jobs: - uses: astral-sh/setup-uv@5a7eac68fb9809dea845d802897dc5c723910fa3 # v7.1.3 - name: Prepare release - uses: getsentry/action-prepare-release@3cea80dc3938c0baf5ec4ce752ecb311f8780cdc # v1.6.4 + uses: getsentry/craft@4b763f5419255bb520e3e5a49f5b91426dcd374d # 3.3.0 env: GITHUB_TOKEN: ${{ steps.token.outputs.token }} with: - version: ${{ github.event.inputs.version }} - force: ${{ github.event.inputs.force }} - merge_target: ${{ github.event.inputs.merge_target }} - path: clients/${{ github.event.inputs.client }} + workspace: ${{ inputs.workspace }} + version: ${{ inputs.version }} + force: ${{ inputs.force }} + merge_target: ${{ inputs.merge_target }} diff --git a/AGENTS.md b/AGENTS.md index 8a3b873e..6738bc0e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -73,7 +73,7 @@ cargo doc --workspace --all-features --no-deps --document-private-items ## Pull Requests -The Python and Rust clients are released separately, each with its own changelog (`clients/python/CHANGELOG.md`, `clients/rust/CHANGELOG.md`). When making a change that touches one of the clients, consider the user-facing changelog entry, which is generated from PR titles: +The Python client, the Rust client and the server are released separately as Craft workspaces (see `.craft.yml`), each with its own changelog (`clients/python/CHANGELOG.md`, `clients/rust/CHANGELOG.md`, `objectstore-server/CHANGELOG.md`). Changelog entries are generated from PR titles: -- A PR is listed in the changelog of every client whose directory it changes, grouped by the conventional commit type of its title (`feat`, `fix`, ...). The scope doesn't matter. -- If the title doesn't describe the change well for client users, add a `### Changelog Entry` section to the PR description with the text to use instead. It's used for every client the PR touches. +- A PR is listed in the changelog of every workspace whose files it changes, grouped by the conventional commit type of its title (`feat`, `fix`, ...). The scope doesn't matter. The server's changelog also covers `objectstore-service` (`includePaths` in `.craft.yml`); files outside all workspaces aren't listed anywhere. +- If the title doesn't describe the change well for users, add a `### Changelog Entry` section to the PR description with the text to use instead. It's used for every changelog the PR is listed in. diff --git a/clients/python/.craft.yml b/clients/python/.craft.yml deleted file mode 100644 index 82b19ceb..00000000 --- a/clients/python/.craft.yml +++ /dev/null @@ -1,17 +0,0 @@ -changelog: - policy: auto - # Group entries only by the categories in `.github/release.yml`. - scopeGrouping: false -preReleaseCommand: ../../scripts/bump-version-py-client.sh -releaseBranchPrefix: release-py - -targets: - - name: github - tagPrefix: py-client@ - - name: pypi - - name: sentry-pypi - internalPypiRepo: getsentry/pypi - -requireNames: - - /.*objectstore_client.*whl$/ - - /.*objectstore_client.*tar\.gz$/ diff --git a/clients/rust/.craft.yml b/clients/rust/.craft.yml deleted file mode 100644 index f1f55988..00000000 --- a/clients/rust/.craft.yml +++ /dev/null @@ -1,14 +0,0 @@ -changelog: - policy: auto - # Group entries only by the categories in `.github/release.yml`. - scopeGrouping: false -preReleaseCommand: ../../scripts/bump-version-rs-client.sh -releaseBranchPrefix: release-rust -# The crates target publishes from source, so there are no build artifacts. -artifactProvider: - name: none - -targets: - - name: github - tagPrefix: rs-client@ - - name: crates diff --git a/clients/rust/.github/release.yml b/clients/rust/.github/release.yml deleted file mode 100644 index 23b3d0bd..00000000 --- a/clients/rust/.github/release.yml +++ /dev/null @@ -1,29 +0,0 @@ -# Changelog categories for this client. Keep in sync with the other client's -# `.github/release.yml`. -# -# A custom file replaces Craft's defaults entirely. It groups entries by change -# type, strips the `type(scope):` prefix, and catches every remaining change so -# it still counts toward the version bump. -changelog: - exclude: - labels: - - skip-changelog - categories: - - title: Breaking Changes - commit_patterns: - - "^(?\\w+(?:\\([^)]+\\))?!:\\s*)" - semver: major - - title: New Features - commit_patterns: - - "^(?feat(?:\\([^)]+\\))?:\\s*)" - semver: minor - - title: Bug Fixes - commit_patterns: - - "^(?fix(?:\\([^)]+\\))?:\\s*)" - semver: patch - # Catch-all: any other conventional type, then any other title. - - title: Other Changes - commit_patterns: - - "^(?\\w+(?:\\([^)]+\\))?:\\s*)" - - ".*" - semver: patch diff --git a/objectstore-server/CHANGELOG.md b/objectstore-server/CHANGELOG.md new file mode 100644 index 00000000..825c32f0 --- /dev/null +++ b/objectstore-server/CHANGELOG.md @@ -0,0 +1 @@ +# Changelog diff --git a/scripts/bump-version-server.sh b/scripts/bump-version-server.sh new file mode 100755 index 00000000..7825a811 --- /dev/null +++ b/scripts/bump-version-server.sh @@ -0,0 +1,17 @@ +#!/bin/bash +set -euxo pipefail + +ROOT_DIR="$(realpath $(dirname "$0")/..)" + +OLD_VERSION="${1}" +NEW_VERSION="${2}" + +echo "Current version: $OLD_VERSION" +echo "Bumping to version: $NEW_VERSION" + +cd $ROOT_DIR +cd objectstore-server +perl -pi -e "s/^version = \".*?\"/version = \"$NEW_VERSION\"/" Cargo.toml + +cd $ROOT_DIR +cargo metadata --format-version 1 >/dev/null # update `Cargo.lock`