From 8ca0c90a36e35e9f63ef8c33c74eb2cfe74e6a84 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Mon, 4 May 2026 14:00:43 +0200 Subject: [PATCH 1/3] chore: trigger releases from main changesets --- .github/pull_request_template.md | 1 - .github/workflows/release.yml | 12 +++----- RELEASING.md | 53 +++++++++++++++----------------- 3 files changed, 28 insertions(+), 38 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 06bfa59..e0eca5e 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -17,6 +17,5 @@ ### If releasing new changes - [ ] Ran `pnpm changeset` to generate a changeset file -- [ ] Added the `release` label to the PR diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 805998b..d44fe1f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,16 +1,17 @@ name: "Release" on: - pull_request: - types: [closed] + push: branches: [main] + paths: + - '.changeset/**' workflow_dispatch: permissions: contents: read # Concurrency control: only one release process can run at a time -# This prevents race conditions if multiple PRs with 'release' label merge simultaneously +# This prevents race conditions if multiple releasable changesets merge simultaneously concurrency: group: release cancel-in-progress: false @@ -19,11 +20,6 @@ jobs: check-changesets: name: Check for changesets runs-on: ubuntu-latest - if: | - github.event_name == 'workflow_dispatch' || - (github.event_name == 'pull_request' && - github.event.pull_request.merged == true && - contains(github.event.pull_request.labels.*.name, 'release')) outputs: has-changesets: ${{ steps.check.outputs.has-changesets }} steps: diff --git a/RELEASING.md b/RELEASING.md index 8359f5b..05d191a 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -1,50 +1,45 @@ # Releasing -This repository uses [Changesets](https://github.com/changesets/changesets) for version management and changelog generation, with GitHub Actions publishing both `posthog-ruby` and `posthog-rails` to RubyGems. +This repository uses [Changesets](https://github.com/changesets/changesets) for version management and an automated GitHub Actions workflow for releases. -Both gems are released together with the same version number. +## How to Release -## How to release +### 1. Add a Changeset -### 1. Add a changeset - -When making changes that should be released, add a changeset: +When making a change that should be released, add a changeset: ```bash pnpm changeset ``` -This will prompt you to: -- select the release type (`patch`, `minor`, or `major`) -- write a summary of the change +This prompts you to select the version bump (`patch`, `minor`, or `major`) and write a short release summary. Commit the generated file in `.changeset/` with your pull request. + +### 2. Merge the Pull Request -The changeset file will be created in the `.changeset/` directory. +After review, merge the PR to `main`. No GitHub release label is required. -### 2. Create a pull request +A push to `main` that includes `.changeset/**` changes automatically starts the release workflow. The workflow then: -Create a PR with your code changes and the changeset file. +1. Checks for pending changesets +2. Notifies the client libraries team in Slack for approval +3. Waits for approval from a maintainer via the GitHub `Release` environment +4. The workflow applies Changesets, syncs gem versions, publishes the gems, tags the release, and creates a GitHub Release. +5. Notifies Slack when the release completes or fails -### 3. Add the `release` label +### Manual Trigger -When the PR is ready to be released, add the `release` label. +You can also manually trigger the release workflow from the Actions tab with `workflow_dispatch`. Manual runs still require pending changesets. -### 4. Merge the PR +## Version Bumping -When a PR with the `release` label is merged to `main`, the release workflow will automatically: +Changesets determines the next version from the committed changeset files: -1. Check for pending changesets -2. Notify the Client Libraries team in Slack for approval -3. Wait for approval via the GitHub `Release` environment -4. Once approved: - - Apply changesets and bump `package.json` - - Update `CHANGELOG.md` - - Sync the version to `lib/posthog/version.rb` - - Commit the version bump to `main` - - Publish `posthog-ruby` and `posthog-rails` to RubyGems - - Create a git tag and GitHub release +- **patch**: bug fixes, documentation updates, and internal changes +- **minor**: backwards-compatible features +- **major**: breaking changes -The workflow publishes `posthog-ruby` first, then `posthog-rails`, since `posthog-rails` depends on `posthog-ruby`. +## Troubleshooting -## Manual trigger +### No changesets found -You can also manually trigger the release workflow from the Actions tab, as long as there are pending changesets. +If the release workflow reports that no changesets were found, make sure your PR includes at least one releasable `.changeset/*.md` file. From 907e70a2bfac9174e47c4220ced1da0742615f75 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Mon, 4 May 2026 14:16:12 +0200 Subject: [PATCH 2/3] chore: skip release workflow on version bump commits --- .github/workflows/release.yml | 4 ++-- RELEASING.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d44fe1f..ce7f32b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,7 +4,7 @@ on: push: branches: [main] paths: - - '.changeset/**' + - '.changeset/*.md' workflow_dispatch: permissions: @@ -133,7 +133,7 @@ jobs: id: commit-version-bump uses: planetscale/ghcommit-action@25309d8005ac7c3bcd61d3fe19b69e0fe47dbdde # v0.2.20 with: - commit_message: "chore: release ${{ steps.apply-changesets.outputs.new-version }} [version bump]" + commit_message: "chore: release ${{ steps.apply-changesets.outputs.new-version }} [version bump] [skip ci]" repo: ${{ github.repository }} branch: main env: diff --git a/RELEASING.md b/RELEASING.md index 05d191a..dc9c970 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -18,7 +18,7 @@ This prompts you to select the version bump (`patch`, `minor`, or `major`) and w After review, merge the PR to `main`. No GitHub release label is required. -A push to `main` that includes `.changeset/**` changes automatically starts the release workflow. The workflow then: +A push to `main` that includes `.changeset/*.md` changes automatically starts the release workflow. The workflow then: 1. Checks for pending changesets 2. Notifies the client libraries team in Slack for approval From 12b12d0c66246c83d09d24106ab8f342260292c7 Mon Sep 17 00:00:00 2001 From: Manoel Aranda Neto Date: Mon, 4 May 2026 14:53:38 +0200 Subject: [PATCH 3/3] docs: keep existing release details --- RELEASING.md | 53 ++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/RELEASING.md b/RELEASING.md index dc9c970..fb59ba9 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -1,45 +1,46 @@ # Releasing -This repository uses [Changesets](https://github.com/changesets/changesets) for version management and an automated GitHub Actions workflow for releases. +This repository uses [Changesets](https://github.com/changesets/changesets) for version management and changelog generation, with GitHub Actions publishing both `posthog-ruby` and `posthog-rails` to RubyGems. -## How to Release +Both gems are released together with the same version number. -### 1. Add a Changeset +## How to release -When making a change that should be released, add a changeset: +### 1. Add a changeset + +When making changes that should be released, add a changeset: ```bash pnpm changeset ``` -This prompts you to select the version bump (`patch`, `minor`, or `major`) and write a short release summary. Commit the generated file in `.changeset/` with your pull request. - -### 2. Merge the Pull Request - -After review, merge the PR to `main`. No GitHub release label is required. - -A push to `main` that includes `.changeset/*.md` changes automatically starts the release workflow. The workflow then: +This will prompt you to: +- select the release type (`patch`, `minor`, or `major`) +- write a summary of the change -1. Checks for pending changesets -2. Notifies the client libraries team in Slack for approval -3. Waits for approval from a maintainer via the GitHub `Release` environment -4. The workflow applies Changesets, syncs gem versions, publishes the gems, tags the release, and creates a GitHub Release. -5. Notifies Slack when the release completes or fails +The changeset file will be created in the `.changeset/` directory. -### Manual Trigger +### 2. Create a pull request -You can also manually trigger the release workflow from the Actions tab with `workflow_dispatch`. Manual runs still require pending changesets. +Create a PR with your code changes and the changeset file. -## Version Bumping +### 3. Merge the PR -Changesets determines the next version from the committed changeset files: +No release label is required. When the PR is merged to `main`, the release workflow will automatically: -- **patch**: bug fixes, documentation updates, and internal changes -- **minor**: backwards-compatible features -- **major**: breaking changes +1. Check for pending changesets +2. Notify the Client Libraries team in Slack for approval +3. Wait for approval via the GitHub `Release` environment +4. Once approved: + - Apply changesets and bump `package.json` + - Update `CHANGELOG.md` + - Sync the version to `lib/posthog/version.rb` + - Commit the version bump to `main` + - Publish `posthog-ruby` and `posthog-rails` to RubyGems + - Create a git tag and GitHub release -## Troubleshooting +The workflow publishes `posthog-ruby` first, then `posthog-rails`, since `posthog-rails` depends on `posthog-ruby`. -### No changesets found +## Manual trigger -If the release workflow reports that no changesets were found, make sure your PR includes at least one releasable `.changeset/*.md` file. +You can also manually trigger the release workflow from the Actions tab, as long as there are pending changesets.