:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
ci(cli): add Sampo release prep (#61443)
Catalin Irimie7f31acb3d918
diff --git a/.github/workflows/ci-cli.yml b/.github/workflows/ci-cli.ymlindex de16f1f82cfc..8b119fcff952 100644--- a/.github/workflows/ci-cli.yml+++ b/.github/workflows/ci-cli.yml@@ -6,6 +6,7 @@ on:paths:- 'cli/**'- '.github/workflows/ci-cli.yml'+ - '.github/workflows/release-cli.yml'concurrency:group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.ymlnew file mode 100644index 000000000000..0999725943ff--- /dev/null+++ b/.github/workflows/release-cli.yml@@ -0,0 +1,564 @@+name: Release CLI++on:+ push:+ branches: [master]+ paths:+ - 'cli/.sampo/changesets/*.md'++permissions:+ contents: read++env:+ SAMPO_VERSION: 0.17.4+ CARGO_DIST_VERSION: 0.32.0+ CARGO_DIST_INSTALLER_SHA256: b657cf8c04a8b7bc28f39d220f7e6dd11bbd2bdb072c552262bd9ccf597261b5++concurrency:+ group: release-cli+ cancel-in-progress: false++jobs:+ check-changesets:+ name: Check for CLI changesets+ runs-on: ubuntu-latest+ timeout-minutes: 5+ outputs:+ has-changesets: ${{ steps.check.outputs.has-changesets }}+ steps:+ - name: Checkout repository+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2+ with:+ ref: master+ fetch-depth: 0++ - name: Check for changesets+ id: check+ run: |+ changeset_count=$(find cli/.sampo/changesets -name '*.md' 2>/dev/null | wc -l)+ if [ "$changeset_count" -gt 0 ]; then+ echo "has-changesets=true" >> "$GITHUB_OUTPUT"+ echo "Found $changeset_count CLI changeset(s), ready to release"+ else+ echo "has-changesets=false" >> "$GITHUB_OUTPUT"+ echo "No CLI changesets to release"+ fi++ notify-approval-needed:+ name: Notify Slack - Approval Needed+ needs: check-changesets+ if: needs.check-changesets.outputs.has-changesets == 'true'+ uses: posthog/.github/.github/workflows/notify-approval-needed.yml@5fc4680761e8ac29a61b212756230eba0e276d8c+ with:+ slack_channel_id: ${{ vars.SLACK_APPROVALS_CLIENT_LIBRARIES_CHANNEL_ID }}+ slack_user_group_id: ${{ vars.GROUP_CLIENT_LIBRARIES_SLACK_GROUP_ID }}+ secrets:+ slack_bot_token: ${{ secrets.SLACK_CLIENT_LIBRARIES_BOT_TOKEN }}+ posthog_project_api_key: ${{ secrets.POSTHOG_PROJECT_API_KEY }}++ release:+ name: Prepare CLI release+ needs: [check-changesets, notify-approval-needed]+ runs-on: ubuntu-latest+ timeout-minutes: 30+ if: always() && needs.check-changesets.outputs.has-changesets == 'true'+ environment: Release SDK+ permissions:+ contents: write+ outputs:+ new-version: ${{ steps.prepare-release.outputs.new-version }}+ release-tag: ${{ steps.release-metadata.outputs.release-tag }}+ release-commit: ${{ steps.commit-release.outputs.commit-hash }}+ steps:+ - name: Notify Slack - Approved+ if: needs.notify-approval-needed.outputs.slack_ts != ''+ uses: posthog/.github/.github/actions/slack-thread-reply@5fc4680761e8ac29a61b212756230eba0e276d8c+ with:+ slack_bot_token: ${{ secrets.SLACK_CLIENT_LIBRARIES_BOT_TOKEN }}+ slack_channel_id: ${{ vars.SLACK_APPROVALS_CLIENT_LIBRARIES_CHANNEL_ID }}+ thread_ts: ${{ needs.notify-approval-needed.outputs.slack_ts }}+ message: 'Release approved. Preparing posthog-cli version bump.'+ emoji_reaction: 'white_check_mark'++ - name: Get GitHub App token+ id: app-token+ uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1+ with:+ client-id: ${{ secrets.GH_APP_POSTHOG_RELEASER_APP_ID }}+ private-key: ${{ secrets.GH_APP_POSTHOG_RELEASER_PRIVATE_KEY }}++ - name: Checkout repository+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2+ with:+ ref: master+ fetch-depth: 0+ token: ${{ steps.app-token.outputs.token }}++ - name: Install Rust+ uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9+ with:+ toolchain: 1.91.1+ components: cargo++ - name: Cache Sampo CLI+ id: cache-sampo+ uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5+ with:+ path: ~/.cargo/bin/sampo+ key: sampo-${{ runner.os }}-${{ runner.arch }}-${{ env.SAMPO_VERSION }}++ - name: Install Sampo CLI+ if: steps.cache-sampo.outputs.cache-hit != 'true'+ run: cargo install sampo --version "$SAMPO_VERSION" --locked++ - name: Prepare release with Sampo+ id: prepare-release+ working-directory: cli+ env:+ GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}+ run: |+ sampo release+ new_version=$(grep '^version = ' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/')++ # Sampo regenerates the whole lockfile; keep the release bump scoped to the local package version.+ git restore Cargo.lock+ cargo update -p posthog-cli --precise "$new_version"+ cargo metadata --format-version 1 --no-deps > /dev/null++ echo "new-version=$new_version" >> "$GITHUB_OUTPUT"+ echo "Prepared posthog-cli v$new_version"++ - name: Check release tag+ env:+ NEW_VERSION: ${{ steps.prepare-release.outputs.new-version }}+ run: |+ release_tag="posthog-cli/v$NEW_VERSION"+ if git ls-remote --exit-code --tags origin "refs/tags/$release_tag" >/dev/null 2>&1; then+ echo "::error::Tag $release_tag already exists"+ exit 1+ fi++ - name: Check release changes+ id: check-changes+ run: |+ changed_files=$(git diff --name-only)+ if [ -z "$changed_files" ]; then+ echo "::error::Sampo did not produce any release changes"+ exit 1+ fi++ unexpected=$(echo "$changed_files" | grep -Ev '^(cli/Cargo\.toml|cli/Cargo\.lock|cli/CHANGELOG\.md|cli/\.sampo/changesets/[^/]+\.md)$' || true)+ if [ -n "$unexpected" ]; then+ echo "::error::Unexpected files changed during CLI release prep:"+ echo "$unexpected"+ exit 1+ fi++ if ! echo "$changed_files" | grep -qx 'cli/Cargo.lock'; then+ echo "::error::CLI release prep did not update cli/Cargo.lock"+ exit 1+ fi++ echo "committed=true" >> "$GITHUB_OUTPUT"++ - name: Commit release changes+ id: commit-release+ if: steps.check-changes.outputs.committed == 'true'+ uses: planetscale/ghcommit-action@25309d8005ac7c3bcd61d3fe19b69e0fe47dbdde # v0.2.20+ with:+ commit_message: 'chore(cli): release v${{ steps.prepare-release.outputs.new-version }}'+ repo: ${{ github.repository }}+ branch: master+ env:+ GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}++ - name: Sync checkout to release commit+ if: steps.commit-release.outputs.commit-hash != ''+ env:+ COMMIT_HASH: ${{ steps.commit-release.outputs.commit-hash }}+ run: |+ git fetch origin master+ git reset --hard "$COMMIT_HASH"++ - name: Set release metadata+ id: release-metadata+ if: steps.commit-release.outputs.commit-hash != ''+ env:+ NEW_VERSION: ${{ steps.prepare-release.outputs.new-version }}+ run: |+ release_tag="posthog-cli/v$NEW_VERSION"+ echo "release-tag=$release_tag" >> "$GITHUB_OUTPUT"++ - name: Send failure event to PostHog+ if: failure()+ uses: PostHog/posthog-github-action@58dea254b598fb5d469c0699c98af8288a7f7650 # v1.2.0+ with:+ posthog-token: '${{ secrets.POSTHOG_PROJECT_API_KEY }}'+ event: 'posthog-cli-github-release-workflow-failure'+ properties: >-+ {+ "commitSha": "${{ github.sha }}",+ "jobStatus": "${{ job.status }}",+ "ref": "${{ github.ref }}",+ "version": "${{ steps.prepare-release.outputs.new-version }}"+ }++ - name: Notify Slack - Failed+ if: failure() && needs.notify-approval-needed.outputs.slack_ts != ''+ uses: posthog/.github/.github/actions/slack-thread-reply@5fc4680761e8ac29a61b212756230eba0e276d8c+ with:+ slack_bot_token: ${{ secrets.SLACK_CLIENT_LIBRARIES_BOT_TOKEN }}+ slack_channel_id: ${{ vars.SLACK_APPROVALS_CLIENT_LIBRARIES_CHANNEL_ID }}+ thread_ts: ${{ needs.notify-approval-needed.outputs.slack_ts }}+ message: 'Failed to prepare posthog-cli release. View logs: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'+ emoji_reaction: 'x'++ # Keep cargo-dist publishing in this workflow so the Release approval gates the full release path.+ # Run 'dist plan' (or host) to determine what tasks we need to do+ plan-release:+ name: Plan cargo-dist release+ needs: release+ if: needs.release.outputs.release-commit != ''+ runs-on: 'ubuntu-22.04'+ timeout-minutes: 10+ outputs:+ val: ${{ steps.plan.outputs.manifest }}+ tag: ${{ steps.release-vars.outputs.tag }}+ tag-flag: ${{ steps.release-vars.outputs.tag-flag }}+ publishing: ${{ steps.release-vars.outputs.publishing }}+ env:+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ steps:+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2+ with:+ ref: ${{ needs.release.outputs.release-commit }}+ submodules: recursive+ - name: Install dist+ shell: bash+ run: |+ installer="$RUNNER_TEMP/cargo-dist-installer.sh"+ curl --proto '=https' --tlsv1.2 -LsSf \+ "https://github.com/axodotdev/cargo-dist/releases/download/v${CARGO_DIST_VERSION}/cargo-dist-installer.sh" \+ -o "$installer"+ if command -v sha256sum >/dev/null 2>&1; then+ echo "${CARGO_DIST_INSTALLER_SHA256} $installer" | sha256sum -c -+ elif command -v shasum >/dev/null 2>&1; then+ actual="$(shasum -a 256 "$installer" | awk '{print $1}')"+ if [ "$actual" != "$CARGO_DIST_INSTALLER_SHA256" ]; then+ echo "::error::cargo-dist installer checksum mismatch"+ echo "expected: $CARGO_DIST_INSTALLER_SHA256"+ echo "actual: $actual"+ exit 1+ fi+ else+ echo "::error::No sha256 checksum tool available"+ exit 1+ fi+ sh "$installer"+ - name: Cache dist+ uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0+ with:+ name: cargo-dist-cache+ path: ~/.cargo/bin/dist+ - id: release-vars+ env:+ RELEASE_TAG: ${{ needs.release.outputs.release-tag }}+ run: |+ echo "tag=$RELEASE_TAG" >> "$GITHUB_OUTPUT"+ echo "tag-flag=--tag=$RELEASE_TAG" >> "$GITHUB_OUTPUT"+ echo "publishing=true" >> "$GITHUB_OUTPUT"+ - id: plan+ env:+ DIST_COMMAND: host --steps=create --tag=${{ needs.release.outputs.release-tag }}+ run: |+ dist $DIST_COMMAND --output-format=json > plan-dist-manifest.json+ echo "dist ran successfully"+ cat plan-dist-manifest.json+ echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT"+ - name: 'Upload dist-manifest.json'+ uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0+ with:+ name: artifacts-plan-dist-manifest+ path: plan-dist-manifest.json++ # Build and packages all the platform-specific things+ build-local-artifacts:+ name: build-local-artifacts (${{ join(matrix.targets, ', ') }})+ # Let the initial task tell us to not run (currently very blunt)+ needs:+ - release+ - plan-release+ if: ${{ fromJson(needs.plan-release.outputs.val).ci.github.artifacts_matrix.include != null }}+ strategy:+ fail-fast: false+ # Target platforms/runners are computed by dist in create-release.+ # Each member of the matrix has the following arguments:+ #+ # - runner: the github runner+ # - dist-args: cli flags to pass to dist+ # - install-dist: expression to run to install dist on the runner+ #+ # Typically there will be:+ # - 1 "global" task that builds universal installers+ # - N "local" tasks that build each platform's binaries and platform-specific installers+ matrix: ${{ fromJson(needs.plan-release.outputs.val).ci.github.artifacts_matrix }}+ runs-on: ${{ matrix.runner }}+ timeout-minutes: 30+ container: ${{ matrix.container && matrix.container.image || null }}+ env:+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ POSTHOG_API_TOKEN: ${{ secrets.POSTHOG_API_TOKEN }}+ BUILD_MANIFEST_NAME: target/distrib/${{ join(matrix.targets, '-') }}-dist-manifest.json+ steps:+ - name: enable windows longpaths+ run: |+ git config --global core.longpaths true+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2+ with:+ ref: ${{ needs.release.outputs.release-commit }}+ submodules: recursive+ - name: Install Rust+ if: ${{ matrix.container }}+ uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9+ with:+ toolchain: 1.91.1+ components: cargo+ - name: Install dist+ shell: bash+ run: |+ installer="$RUNNER_TEMP/cargo-dist-installer.sh"+ curl --proto '=https' --tlsv1.2 -LsSf \+ "https://github.com/axodotdev/cargo-dist/releases/download/v${CARGO_DIST_VERSION}/cargo-dist-installer.sh" \+ -o "$installer"+ if command -v sha256sum >/dev/null 2>&1; then+ echo "${CARGO_DIST_INSTALLER_SHA256} $installer" | sha256sum -c -+ elif command -v shasum >/dev/null 2>&1; then+ actual="$(shasum -a 256 "$installer" | awk '{print $1}')"+ if [ "$actual" != "$CARGO_DIST_INSTALLER_SHA256" ]; then+ echo "::error::cargo-dist installer checksum mismatch"+ echo "expected: $CARGO_DIST_INSTALLER_SHA256"+ echo "actual: $actual"+ exit 1+ fi+ else+ echo "::error::No sha256 checksum tool available"+ exit 1+ fi+ sh "$installer"+ # Get the dist-manifest+ - name: Fetch local artifacts+ uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0+ with:+ pattern: artifacts-*+ path: target/distrib/+ merge-multiple: true+ - name: Install dependencies+ run: |+ ${{ matrix.packages_install }}+ - name: Build artifacts+ run: |+ # Actually do builds and make zips and whatnot+ dist build ${{ needs.plan-release.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json+ echo "dist ran successfully"+ - id: cargo-dist+ name: Post-build+ # We force bash here just because github makes it really hard to get values up+ # to "real" actions without writing to env-vars, and writing to env-vars has+ # inconsistent syntax between shell and powershell.+ shell: bash+ run: |+ # Parse out what we just built and upload it to scratch storage+ echo "paths<<EOF" >> "$GITHUB_OUTPUT"+ dist print-upload-files-from-manifest --manifest dist-manifest.json >> "$GITHUB_OUTPUT"+ echo "EOF" >> "$GITHUB_OUTPUT"++ cp dist-manifest.json "$BUILD_MANIFEST_NAME"+ - name: 'Upload artifacts'+ uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0+ with:+ name: artifacts-build-local-${{ join(matrix.targets, '_') }}+ path: |+ ${{ steps.cargo-dist.outputs.paths }}+ ${{ env.BUILD_MANIFEST_NAME }}++ # Build and package all the platform-agnostic(ish) things+ build-global-artifacts:+ needs:+ - release+ - plan-release+ - build-local-artifacts+ if: ${{ needs.build-local-artifacts.result == 'success' }}+ runs-on: 'ubuntu-22.04'+ timeout-minutes: 15+ env:+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ BUILD_MANIFEST_NAME: target/distrib/global-dist-manifest.json+ POSTHOG_API_TOKEN: ${{ secrets.POSTHOG_API_TOKEN }}+ steps:+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2+ with:+ ref: ${{ needs.release.outputs.release-commit }}+ submodules: recursive+ - name: Install cached dist+ uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0+ with:+ name: cargo-dist-cache+ path: ~/.cargo/bin/+ - run: chmod +x ~/.cargo/bin/dist+ # Get all the local artifacts for the global tasks to use (for e.g. checksums)+ - name: Fetch local artifacts+ uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0+ with:+ pattern: artifacts-*+ path: target/distrib/+ merge-multiple: true+ - id: cargo-dist+ shell: bash+ run: |+ dist build ${{ needs.plan-release.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json+ echo "dist ran successfully"++ # Parse out what we just built and upload it to scratch storage+ echo "paths<<EOF" >> "$GITHUB_OUTPUT"+ jq --raw-output ".upload_files[]" dist-manifest.json >> "$GITHUB_OUTPUT"+ echo "EOF" >> "$GITHUB_OUTPUT"++ cp dist-manifest.json "$BUILD_MANIFEST_NAME"+ - name: 'Upload artifacts'+ uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0+ with:+ name: artifacts-build-global+ path: |+ ${{ steps.cargo-dist.outputs.paths }}+ ${{ env.BUILD_MANIFEST_NAME }}++ # Determines if we should publish/announce+ host-release:+ needs:+ - release+ - plan-release+ - build-local-artifacts+ - build-global-artifacts+ # Only run if we're "publishing", and only if local and global didn't fail (skipped is fine)+ if: ${{ always() && needs.plan-release.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }}+ runs-on: 'ubuntu-22.04'+ timeout-minutes: 15+ outputs:+ val: ${{ steps.host.outputs.manifest }}+ steps:+ - name: Get app token+ id: app-token+ uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1+ with:+ client-id: ${{ secrets.GH_APP_POSTHOG_RELEASER_APP_ID }}+ private-key: ${{ secrets.GH_APP_POSTHOG_RELEASER_PRIVATE_KEY }}++ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2+ with:+ ref: ${{ needs.release.outputs.release-commit }}+ submodules: recursive+ token: ${{ steps.app-token.outputs.token }}+ - name: Install cached dist+ uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0+ with:+ name: cargo-dist-cache+ path: ~/.cargo/bin/+ - run: chmod +x ~/.cargo/bin/dist+ # Fetch artifacts from scratch-storage+ - name: Fetch artifacts+ uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0+ with:+ pattern: artifacts-*+ path: target/distrib/+ merge-multiple: true+ - id: host+ shell: bash+ run: |+ dist host ${{ needs.plan-release.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json+ echo "artifacts uploaded and released successfully"+ cat dist-manifest.json+ echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"+ - name: 'Upload dist-manifest.json'+ uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0+ with:+ # Overwrite the previous copy+ name: artifacts-dist-manifest+ path: dist-manifest.json+ # Create a GitHub Release while uploading all files to it+ - name: 'Download GitHub Artifacts'+ uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0+ with:+ pattern: artifacts-*+ path: artifacts+ merge-multiple: true+ - name: Cleanup+ run: |+ # Remove the granular manifests+ rm -f artifacts/*-dist-manifest.json+ - name: Create GitHub Release+ env:+ PRERELEASE_FLAG: "${{ fromJson(steps.host.outputs.manifest).announcement_is_prerelease && '--prerelease' || '' }}"+ ANNOUNCEMENT_TITLE: '${{ fromJson(steps.host.outputs.manifest).announcement_title }}'+ ANNOUNCEMENT_BODY: '${{ fromJson(steps.host.outputs.manifest).announcement_github_body }}'+ RELEASE_COMMIT: '${{ needs.release.outputs.release-commit }}'+ GH_TOKEN: ${{ steps.app-token.outputs.token }}+ run: |+ # Write and read notes from a file to avoid quoting breaking things+ echo "$ANNOUNCEMENT_BODY" > $RUNNER_TEMP/notes.txt+ gh release create "${{ needs.plan-release.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*++ publish-npm:+ needs:+ - release+ - plan-release+ - host-release+ runs-on: 'ubuntu-22.04'+ timeout-minutes: 10+ env:+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ PLAN: ${{ needs.plan-release.outputs.val }}+ if: ${{ !fromJson(needs.plan-release.outputs.val).announcement_is_prerelease || fromJson(needs.plan-release.outputs.val).publish_prereleases }}+ permissions:+ id-token: write+ steps:+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2+ with:+ ref: ${{ needs.release.outputs.release-commit }}+ sparse-checkout: .nvmrc+ sparse-checkout-cone-mode: false+ - name: Fetch npm packages+ uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0+ with:+ pattern: artifacts-*+ path: npm/+ merge-multiple: true+ - uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0+ with:+ node-version-file: .nvmrc+ registry-url: 'https://registry.npmjs.org'+ - name: Ensure modern npm (OIDC support)+ run: npm install -g [email protected]+ - run: |+ for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith("-npm-package.tar.gz")] | any)'); do+ pkg=$(echo "$release" | jq '.artifacts[] | select(endswith("-npm-package.tar.gz"))' --raw-output)+ npm publish --access public "./npm/${pkg}"+ done+ env:+ NPM_CONFIG_PROVENANCE: true+ NODE_AUTH_TOKEN: ''++ notify-released:+ name: Notify Slack - Release Published+ needs: [notify-approval-needed, release, host-release, publish-npm]+ runs-on: ubuntu-latest+ timeout-minutes: 5+ if: always() && needs.host-release.result == 'success' && (needs.publish-npm.result == 'success' || needs.publish-npm.result == 'skipped') && needs.notify-approval-needed.outputs.slack_ts != ''+ steps:+ - name: Notify Slack - Release Published+ uses: posthog/.github/.github/actions/slack-thread-reply@5fc4680761e8ac29a61b212756230eba0e276d8c+ with:+ slack_bot_token: ${{ secrets.SLACK_CLIENT_LIBRARIES_BOT_TOKEN }}+ slack_channel_id: ${{ vars.SLACK_APPROVALS_CLIENT_LIBRARIES_CHANNEL_ID }}+ thread_ts: ${{ needs.notify-approval-needed.outputs.slack_ts }}+ message: 'posthog-cli release ${{ needs.release.outputs.new-version }} published for ${{ needs.release.outputs.release-tag }}.'+ emoji_reaction: 'rocket'diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 021b636902ed..18d33bd9a009 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -1,48 +1,23 @@-# This file was autogenerated by dist: https://opensource.axo.dev/cargo-dist/+# This workflow is derived from cargo-dist's generated release workflow:+# https://opensource.axo.dev/cargo-dist/+# It is maintained manually because Release CLI owns publishing.## Copyright 2022-2024, axodotdev# SPDX-License-Identifier: MIT or Apache-2.0#-# CI that:-#-# * checks for a Git Tag that looks like a release-# * builds artifacts with dist (archives, installers, hashes)-# * uploads those artifacts to temporary workflow zip-# * on success, uploads the artifacts to a GitHub Release-#-# Note that the GitHub Release will be created with a generated-# title/body based on your changelogs.+# CI that checks cargo-dist packaging for pull requests.name: Releasepermissions:contents: read-# This task will run whenever you push a git tag that looks like a version-# like "1.0.0", "v0.1.0-prerelease.1", "my-app/0.1.0", "releases/v1.0.0", etc.-# Various formats will be parsed into a VERSION and an optional PACKAGE_NAME, where-# PACKAGE_NAME must be the name of a Cargo package in your workspace, and VERSION-# must be a Cargo-style SemVer Version (must have at least major.minor.patch).-#-# If PACKAGE_NAME is specified, then the announcement will be for that-# package (erroring out if it doesn't have the given version or isn't dist-able).-#-# If PACKAGE_NAME isn't specified, then the announcement will be for all-# (dist-able) packages in the workspace with that version (this mode is-# intended for workspaces with only one dist-able package, or with all dist-able-# packages versioned/released in lockstep).-#-# If you push multiple tags at once, separate instances of this workflow will-# spin up, creating an independent announcement for each one. However, GitHub-# will hard limit this to 3 tags per commit, as it will assume more tags is a-# mistake.-#-# If there's a prerelease-style suffix to the version, then the release(s)-# will be marked as a prerelease.+env:+ CARGO_DIST_VERSION: 0.32.0+ CARGO_DIST_INSTALLER_SHA256: b657cf8c04a8b7bc28f39d220f7e6dd11bbd2bdb072c552262bd9ccf597261b5++# Publishing is handled by the Release CLI workflow after Release environment approval.on:pull_request:- push:- tags:- - 'posthog-cli/v[0-9]+.[0-9]+.[0-9]+*'jobs:# Run 'dist plan' (or host) to determine what tasks we need to do@@ -51,9 +26,9 @@ jobs:timeout-minutes: 10outputs:val: ${{ steps.plan.outputs.manifest }}- tag: ${{ !github.event.pull_request && github.ref_name || '' }}- tag-flag: ${{ !github.event.pull_request && format('--tag={0}', github.ref_name) || '' }}- publishing: ${{ !github.event.pull_request }}+ tag: ''+ tag-flag: ''+ publishing: 'false'env:GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}steps:@@ -61,10 +36,27 @@ jobs:with:submodules: recursive- name: Install dist- # we specify bash to get pipefail; it guards against the `curl` command- # failing. otherwise `sh` won't catch that `curl` returned non-0shell: bash- run: "curl --proto '=https' --tlsv1.2 -LsSf https://github.com/axodotdev/cargo-dist/releases/download/v0.32.0/cargo-dist-installer.sh | sh"+ run: |+ installer="$RUNNER_TEMP/cargo-dist-installer.sh"+ curl --proto '=https' --tlsv1.2 -LsSf \+ "https://github.com/axodotdev/cargo-dist/releases/download/v${CARGO_DIST_VERSION}/cargo-dist-installer.sh" \+ -o "$installer"+ if command -v sha256sum >/dev/null 2>&1; then+ echo "${CARGO_DIST_INSTALLER_SHA256} $installer" | sha256sum -c -+ elif command -v shasum >/dev/null 2>&1; then+ actual="$(shasum -a 256 "$installer" | awk '{print $1}')"+ if [ "$actual" != "$CARGO_DIST_INSTALLER_SHA256" ]; then+ echo "::error::cargo-dist installer checksum mismatch"+ echo "expected: $CARGO_DIST_INSTALLER_SHA256"+ echo "actual: $actual"+ exit 1+ fi+ else+ echo "::error::No sha256 checksum tool available"+ exit 1+ fi+ sh "$installer"- name: Cache distuses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0with:@@ -77,7 +69,7 @@ jobs:# but also really annoying to build CI around when it needs secrets to work right.)- id: planenv:- DIST_COMMAND: ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }}+ DIST_COMMAND: planrun: |dist $DIST_COMMAND --output-format=json > plan-dist-manifest.jsonecho "dist ran successfully"@@ -95,7 +87,7 @@ jobs:# Let the initial task tell us to not run (currently very blunt)needs:- plan- if: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix.include != null && (needs.plan.outputs.publishing == 'true' || fromJson(needs.plan.outputs.val).ci.github.pr_run_mode == 'upload') && (!github.event.pull_request || github.event.pull_request.head.repo.full_name == github.repository) }}+ if: ${{ fromJson(needs.plan.outputs.val).ci.github.artifacts_matrix.include != null && fromJson(needs.plan.outputs.val).ci.github.pr_run_mode == 'upload' && (!github.event.pull_request || github.event.pull_request.head.repo.full_name == github.repository) }}strategy:fail-fast: false# Target platforms/runners are computed by dist in create-release.@@ -123,15 +115,34 @@ jobs:- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2with:submodules: recursive- - name: Install Rust non-interactively if not already installed+ - name: Install Rustif: ${{ matrix.container }}+ uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9+ with:+ toolchain: 1.91.1+ components: cargo+ - name: Install dist+ shell: bashrun: |- if ! command -v cargo > /dev/null 2>&1; then- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y- echo "$HOME/.cargo/bin" >> $GITHUB_PATH+ installer="$RUNNER_TEMP/cargo-dist-installer.sh"+ curl --proto '=https' --tlsv1.2 -LsSf \+ "https://github.com/axodotdev/cargo-dist/releases/download/v${CARGO_DIST_VERSION}/cargo-dist-installer.sh" \+ -o "$installer"+ if command -v sha256sum >/dev/null 2>&1; then+ echo "${CARGO_DIST_INSTALLER_SHA256} $installer" | sha256sum -c -+ elif command -v shasum >/dev/null 2>&1; then+ actual="$(shasum -a 256 "$installer" | awk '{print $1}')"+ if [ "$actual" != "$CARGO_DIST_INSTALLER_SHA256" ]; then+ echo "::error::cargo-dist installer checksum mismatch"+ echo "expected: $CARGO_DIST_INSTALLER_SHA256"+ echo "actual: $actual"+ exit 1+ fi+ else+ echo "::error::No sha256 checksum tool available"+ exit 1fi- - name: Install dist- run: ${{ matrix.install_dist.run }}+ sh "$installer"# Get the dist-manifest- name: Fetch local artifactsuses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0@@ -215,113 +226,3 @@ jobs:path: |${{ steps.cargo-dist.outputs.paths }}${{ env.BUILD_MANIFEST_NAME }}- # Determines if we should publish/announce- host:- needs:- - plan- - build-local-artifacts- - build-global-artifacts- # Only run if we're "publishing", and only if local and global didn't fail (skipped is fine)- if: ${{ always() && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }}- runs-on: 'ubuntu-22.04'- timeout-minutes: 15- outputs:- val: ${{ steps.host.outputs.manifest }}- steps:- - name: Get app token- id: app-token- uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1- with:- client-id: ${{ secrets.GH_APP_POSTHOG_RELEASER_APP_ID }}- private-key: ${{ secrets.GH_APP_POSTHOG_RELEASER_PRIVATE_KEY }}-- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2- with:- submodules: recursive- token: ${{ steps.app-token.outputs.token }}- - name: Install cached dist- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0- with:- name: cargo-dist-cache- path: ~/.cargo/bin/- - run: chmod +x ~/.cargo/bin/dist- # Fetch artifacts from scratch-storage- - name: Fetch artifacts- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0- with:- pattern: artifacts-*- path: target/distrib/- merge-multiple: true- - id: host- shell: bash- run: |- dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json- echo "artifacts uploaded and released successfully"- cat dist-manifest.json- echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT"- - name: 'Upload dist-manifest.json'- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0- with:- # Overwrite the previous copy- name: artifacts-dist-manifest- path: dist-manifest.json- # Create a GitHub Release while uploading all files to it- - name: 'Download GitHub Artifacts'- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0- with:- pattern: artifacts-*- path: artifacts- merge-multiple: true- - name: Cleanup- run: |- # Remove the granular manifests- rm -f artifacts/*-dist-manifest.json- - name: Create GitHub Release- env:- PRERELEASE_FLAG: "${{ fromJson(steps.host.outputs.manifest).announcement_is_prerelease && '--prerelease' || '' }}"- ANNOUNCEMENT_TITLE: '${{ fromJson(steps.host.outputs.manifest).announcement_title }}'- ANNOUNCEMENT_BODY: '${{ fromJson(steps.host.outputs.manifest).announcement_github_body }}'- RELEASE_COMMIT: '${{ github.sha }}'- GH_TOKEN: ${{ steps.app-token.outputs.token }}- run: |- # Write and read notes from a file to avoid quoting breaking things- echo "$ANNOUNCEMENT_BODY" > $RUNNER_TEMP/notes.txt- gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*-- publish-npm:- needs:- - plan- - host- runs-on: 'ubuntu-22.04'- timeout-minutes: 10- env:- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}- PLAN: ${{ needs.plan.outputs.val }}- if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }}- permissions:- id-token: write- steps:- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2- with:- sparse-checkout: .nvmrc- sparse-checkout-cone-mode: false- - name: Fetch npm packages- uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0- with:- pattern: artifacts-*- path: npm/- merge-multiple: true- - uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0- with:- node-version-file: .nvmrc- registry-url: 'https://registry.npmjs.org'- - name: Ensure modern npm (OIDC support)- run: npm install -g [email protected]- - run: |- for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith("-npm-package.tar.gz")] | any)'); do- pkg=$(echo "$release" | jq '.artifacts[] | select(endswith("-npm-package.tar.gz"))' --raw-output)- npm publish --access public "./npm/${pkg}"- done- env:- NPM_CONFIG_PROVENANCE: true- NODE_AUTH_TOKEN: ''diff --git a/cli/.sampo/README.md b/cli/.sampo/README.mdnew file mode 100644index 000000000000..dcee6ceb4fa6--- /dev/null+++ b/cli/.sampo/README.md@@ -0,0 +1,18 @@+# Sampo++This directory stores pending release changesets for `posthog-cli`.++Run from `cli/`:++```bash+sampo add --package cargo/posthog-cli --bump patch --message "Describe the CLI change"+```++The release workflow consumes files in `cli/.sampo/changesets/`, updates+`cli/Cargo.toml`, `cli/Cargo.lock`, and `cli/CHANGELOG.md`, then commits the+release bump to `master`. The same approved `Release CLI` workflow runs+cargo-dist against that release commit, creates the `posthog-cli/vX.Y.Z`+GitHub release, and publishes the npm package.++Do not run `sampo publish` or push `posthog-cli/vX.Y.Z` tags manually for+`posthog-cli`; cargo-dist publishing is owned by `Release CLI`.diff --git a/cli/.sampo/changesets/.gitkeep b/cli/.sampo/changesets/.gitkeepnew file mode 100644index 000000000000..8b137891791f--- /dev/null+++ b/cli/.sampo/changesets/.gitkeep@@ -0,0 +1 @@+diff --git a/cli/.sampo/config.toml b/cli/.sampo/config.tomlnew file mode 100644index 000000000000..57bbac49fc92--- /dev/null+++ b/cli/.sampo/config.toml@@ -0,0 +1,12 @@+# Sampo configuration for posthog-cli releases.+version = 1++[git]+default_branch = "master"++[github]+repository = "PostHog/posthog"++[packages]+ignore_unpublished = false+ignore = []diff --git a/cli/CHANGELOG.md b/cli/CHANGELOG.mdindex 3daeefa43a85..254503346997 100644--- a/cli/CHANGELOG.md+++ b/cli/CHANGELOG.md@@ -1,217 +1,217 @@# posthog-cli-# 0.7.18+## 0.7.18- fix: rename `--env-file` to `--dotenv-file`. The npm package runs the CLI binary through a `node` wrapper script, and Node has its own built-in `--env-file` flag — so Node intercepted the flag before it reached the binary, failing with `node: .env: not found` for a missing file. `--env-file` still works as an alias for native installs.-# 0.7.17+## 0.7.17- fix: treat a missing `--env-file` as a warning instead of a fatal error — the CLI logs that the file wasn't found and falls back to the other credential sources (process env, then stored credentials). A file that exists but can't be read still errors.-# 0.7.16+## 0.7.16- feat: add `--dry-run` flag (and `POSTHOG_CLI_DRY_RUN` env var) to skip artifact uploads (sourcemap, dSYM, Hermes, ProGuard) without contacting PostHog or requiring credentials — for CI gates that bundle to catch regressions but must not upload.-# 0.7.15+## 0.7.15- fix: make symbol upload retry logs clearer and report failed finalization explicitly.-# 0.7.14+## 0.7.14- feat: add `--env-file <PATH>` to load `POSTHOG_CLI_HOST`, `POSTHOG_CLI_API_KEY`, and `POSTHOG_CLI_PROJECT_ID` (and their legacy aliases) from a dotenv-style file when not set in the process environment. Credentials are resolved atomically from a single source (process env first, then the file), so `POSTHOG_CLI_HOST` from the file cannot redirect a key supplied by the process env.-# 0.7.13+## 0.7.13- chore: bump `cargo-dist` to 0.32.0; the new npm installer drops the bundled transitive deps that were carrying open CVEs (`axios`, `follow-redirects`, `minimatch`, `brace-expansion`)-# 0.7.12+## 0.7.12- feat: add `--skip-on-conflict` to symbol upload commands for keeping existing symbol sets when content differs- feat: add `--force` to sourcemap, Hermes, and ProGuard uploads for explicit content overwrites-# 0.7.11+## 0.7.11- fix: resolve release once in `process` command to avoid race condition when multiple workers run in parallel- fix: skip synthetic Swift CU names (e.g. `<swift-imported-modules>`) before joining with `comp_dir` so they no longer dominate the project-root prefix and reject real source files-# 0.7.10+## 0.7.10- feat: add `symbol-sets download` command to download symbol sets by ID or ref- feat: add `symbol-sets extract` command for local file extraction- fix: prevent ZIP path traversal in dSYM extraction- fix: validate symbol set ID is a UUID before download-# 0.7.9+## 0.7.9- feat: warn and skip empty sourcemaps (no mappings/sources/names) during upload to surface bundler misconfigurations instead of silently uploading useless symbol sets-# 0.7.8+## 0.7.8- feat: add `--build` flag to all upload commands (hermes, dsym, proguard, sourcemap) via shared ReleaseArgs- feat: build number packed into version string (`"1.0+42"`) for release uniqueness; UI splits on `+` to display version and build separately-# 0.7.7+## 0.7.7- fix: align `dsym upload` release flags with other upload commands by using `--release-name` / `--release-version` (with backward-compatible aliases)- fix: reuse shared release args in `dsym upload` so release fallback behavior matches other upload commands-# 0.7.5+## 0.7.5- fix: stable source bundle for dSYM uploads — CU-anchored prefix filter prevents framework sources from changing the content hash- fix: thin fat dSYM binaries per arch before zipping so sibling arch rebuilds don't cause content_hash_mismatch- fix: add `--force` flag to allow overwriting symbol sets whose content has changed-# 0.7.4+## 0.7.4- fix: create per-UUID ZIP for dSYM uploads-# 0.7.3+## 0.7.3- feat: enable symbol set compression- fix: fix process command reading from stdin-# 0.7.2+## 0.7.2- feat: allow reading files and directories from stdin-# 0.7.1+## 0.7.1- feat: track upload started and upload finished events-# 0.7.0+## 0.7.0- feat: promote dsym, hermes, and proguard commands from experimental to top-level- feat: keep backward-compat aliases under `exp` (hidden from help)-# 0.6.2+## 0.6.2- fix: endpoints now save to YAML with proper newlines-# 0.6.1+## 0.6.1- chore: bump `cargo-dist` version-# 0.6.0+## 0.6.0- Add experimental dSYM upload for iOS/macOS crash symbolication-# 0.5.30+## 0.5.30- Add experimental dSYM upload for iOS/macOS crash symbolication-# 0.5.29+## 0.5.29- chore: introduce env variable `POSTHOG_CLI_API_KEY` and `POSTHOG_CLI_PROJECT_ID` (backwards compatible)-# 0.5.28+## 0.5.28- chore: introduce `--release-name` and `--release-version` options (backwards compatible)-# 0.5.27+## 0.5.27- fix: only warns on release id mismatch errors-# 0.5.26+## 0.5.26- feat: use env variables provided by github actions when available-# 0.5.24+## 0.5.24- chore: add endpoints use case to cli auth flow-# 0.5.23+## 0.5.23- feat: add experimental commands for endpoints management-# 0.5.22+## 0.5.22- feat: add `--project` and `--version` to upload command to define release-# 0.5.20+## 0.5.20- chore: add global `--rate-limit` option for Posthog client-# 0.5.19+## 0.5.19- chore: upgrade cargo-dist to 0.30.3-# 0.5.18+## 0.5.18- fix: fix git info parsing in vercel environment-# 0.5.17+## 0.5.17- feat: add --file option to target built files directly-# 0.5.16+## 0.5.16- fix: cut a new version for fixing compromised package-# 0.5.15+## 0.5.15- Compromised-# 0.5.14+## 0.5.14- Fix authentication issue on sourcemap upload-# 0.5.13+## 0.5.13- Add `--include` option on sourcemap commands to match specific files inside directory-# 0.5.12+## 0.5.12- Bug fixes and improvements-# 0.5.11+## 0.5.11- Do not read bundle files as part of hermes sourcemap commands- Change hermes clone command to take two file paths (for the minified and composed maps respectively)-# 0.5.10+## 0.5.10- Add terminal checks for login and query command-# 0.5.9+## 0.5.9- Improve error handling from api- Reduce logs for sourcemap processing-# 0.5.8+## 0.5.8- Adding experimental support for proguard mappings-# 0.5.7+## 0.5.7- Fix bug where files point to the same sourcemap-# 0.5.6+## 0.5.6- Adding experimental support for hermes sourcemaps-# 0.5.5+## 0.5.5- When running inject command multiple times, we only update chunk ids when releases are different-# 0.5.4+## 0.5.4- Added no fail flag to disable non-zero exit codes on errors.-# 0.5.3+## 0.5.3- Add support for ignoring public path prefixes appended by bundlers to sourceMappingURLs when searching for sourcemapsassociated with minified source code. Does not modify the sourceMappingURL as published.-# 0.5.2+## 0.5.2- Fixes a bug where chunks which shared a sourcemap were mishandled, leading to an error during upload in recent versions, and a silentfailure in older versions. If you're using next, and saw an error message about "duplicate chunk IDs", this fix addresses that issue.-# 0.5.1+## 0.5.1- Attempts to reduce impact of previous breaking changes - re-adds `--project` and `--version` arguments to sourcemap upload command, marking them as no longer used-# 0.5.0+## 0.5.0- Sourcemap injection, upload and process commands made retriable. Significant improvement to release creation.diff --git a/cli/CONTRIBUTING.md b/cli/CONTRIBUTING.mdindex 23c5855b2215..e46be0ae4675 100644--- a/cli/CONTRIBUTING.md+++ b/cli/CONTRIBUTING.md@@ -1,27 +1,32 @@## Releases-Releases are cut by pushing a release tag to the repository, for the `posthog-cli` app. Generally we want to do this on a branch,-and bump the package version number at the same time.+Releases are prepared with [Sampo](https://github.com/bruits/sampo) changesets and published by the `Release CLI`+workflow's [`cargo-dist`](https://github.com/axodotdev/cargo-dist) jobs.++When making a releasable CLI change, add a changeset from the `./cli` directory:```bash-git checkout -b "cli/release-v0.1.0-pre1"+sampo add --package cargo/posthog-cli --bump patch --message "Describe the CLI change"```-1. Bump version number in Cargo.toml-2. Build to update Cargo.lock (cargo build)-3. Update the CHANGELOG.md+Use `minor` or `major` instead of `patch` when appropriate. Commit the generated file under+`cli/.sampo/changesets/` with your pull request.-```bash-git add .-git commit -m "Bump version number"-git tag "posthog-cli/v0.1.0-prerelease.1"-git push-git push --tags-# Optional - also publish to crates.io-cd cli && cargo publish-```+After the pull request merges to `master`, the `Release CLI` workflow:++1. Checks for pending CLI changesets+2. Waits for approval in the GitHub `Release SDK` environment+3. Runs `sampo release` from `./cli`+4. Updates `cli/Cargo.toml`, `cli/Cargo.lock`, and `cli/CHANGELOG.md`+5. Commits the release bump to `master`+6. Runs cargo-dist against the release bump commit+7. Creates the GitHub release and publishes the npm package++Do not run `sampo publish`; cargo-dist owns publishing for `posthog-cli`.-We manage publishing releases through [`cargo-dist`](https://github.com/axodotdev/cargo-dist)+If you need to cut a release by hand, merge a CLI changeset to `master` and let `Release CLI` run from there.+Do not push `posthog-cli/vX.Y.Z` tags manually; cargo-dist tag-push releases are disabled.+If cargo-dist fails after `Release CLI` commits the release bump, rerun the failed jobs from the same workflow run.We release semi-regularly, as new features are added. If a release breaks your CI or workflow, please open an issue on GitHub, and tag one or all of the crate authorsdiff --git a/cli/Cargo.toml b/cli/Cargo.tomlindex 012ded4cedcf..514a42c13ab0 100644--- a/cli/Cargo.toml+++ b/cli/Cargo.toml@@ -1,3 +1,7 @@+[workspace]+members = ["."]+resolver = "2"+[package]name = "posthog-cli"version = "0.7.18"@@ -12,7 +16,6 @@ license = "MIT"edition = "2021"repository = "https://github.com/PostHog/posthog"readme = "README.md"-resolver = "2"[[bin]]name = "posthog-cli"diff --git a/dist-workspace.toml b/dist-workspace.tomlindex b82e3e3f4dc0..4f9eb8a7ebdb 100644--- a/dist-workspace.toml+++ b/dist-workspace.toml@@ -9,6 +9,8 @@ allow-dirty = ["ci"]cargo-dist-version = "0.32.0"# CI backends to supportci = "github"+# Keep generated release workflows off tag-push publishing; Release CLI owns publishing+dispatch-releases = true# The installers to generate for each appinstallers = ["shell", "powershell", "npm"]# Target platforms to build apps for (Rust target-triple syntax)