SDK releases
Contents
This guide documents our semi-automated release process for PostHog SDKs. Each SDK repository uses a GitHub App with restricted permissions to handle releases securely, requiring team approval before any release is published.
Not all SDKs have been migrated to this process yet, but any new SDKs should definitely follow this approach. The Security folks are working on bringing all SDKs up to speed but that will take a while since we have so many of them.
How it works
Our SDK release process uses a dedicated GitHub App per repository that can push directly to the main branch (bypassing branch protections) while still requiring human approval through GitHub Environments. This gives us:
- Security: The app only has access to the specific repository it needs
- Auditability: All releases require approval from the Client Libraries team
- Automation: Changelog generation, version bumping, and publishing are handled automatically
Setting up releases for a new SDK
When creating a new SDK, or migrating an existing one to the new workflow, follow these steps to set up the release infrastructure.
NOTE: Most of these steps require super administrator privileges on GitHub. Make sure you have the appropriate permissions to work on this.
1. Create a GitHub App
Go to GitHub App settings and create a new app:
- Name:
Releaser (<sdk_name>)(e.g.,Releaser (posthog-go)) - Description: Should be "Used to release new versions of
posthog-<sdk_name>(e.g. "Used to release new versions ofposthog-go.") - Homepage URL: Point to the SDK's docs page on posthog.com (e.g.,
https://posthog.com/docs/libraries/go) - Webhook: Disable (uncheck "Active")
- Permissions: Under "Repository permissions", set only:
Contents: Read and write
- Click Create GitHub App
After creating the app:
- Upload the following image as the app icon and set the background color to
#D97148

- Click the big button to generate a private key and save it locally — you'll need it later
- Go to Install App in the sidebar
- Install the app, restricting it to only the SDK repository
2. Create a release environment
In your SDK repository settings:
- Go to Environments and create a new environment named
Release - Configure protection rules:
- Required reviewers: Add
Client librariesas the team that can review - Prevent self-review: Enable this option
- Allow administrators to bypass: Leave this unchecked
- Required reviewers: Add

Add environment secrets:
GH_APP_POSTHOG_<SDK_NAME>_RELEASER_APP_ID— Copy the App ID from your GitHub App settingsGH_APP_POSTHOG_<SDK_NAME>_RELEASER_PRIVATE_KEY— Paste the private key you downloaded, include the trailing newline
Replace
<SDK_NAME>with your SDK name in uppercase with underscores (e.g.,GH_APP_POSTHOG_GO_RELEASER_APP_ID,GH_APP_POSTHOG_GO_RELEASER_PRIVATE_KEY)

3. Add app to bypass lists
The GitHub App needs to bypass certain protections to push release commits directly.
CodeQL bypass
- Go to org settings
- Navigate to Repository → Rulesets
- Click on Address CodeQL findings
- Under Bypass list, click Add bypass
- Select your newly created GitHub App (
Releaser (<sdk_name>)) - Click the three-dot menu and choose Exempt
- Save the ruleset

Repository PR bypass
- Go to your SDK repository settings
- Navigate to Rules → Rulesets
- Open the ruleset that requires PRs (may have various names)
- If this ruleset doesn't exist, create one requiring PRs and reviews from codeowners which should be
@PostHog/team-client-librariesfor all files
- If this ruleset doesn't exist, create one requiring PRs and reviews from codeowners which should be
- Under Bypass list, click Add bypass
- Select your GitHub App (
Releaser (<sdk_name>)) - Click the three-dot menu and choose Exempt
- Save the ruleset

4. Grant access to organization secrets
The release workflow needs access to shared organization secrets. Grant your SDK repository access to the below organization secrets via Terraform:
Secrets:
SLACK_CLIENT_LIBRARIES_BOT_TOKENPOSTHOG_PROJECT_API_KEY
Variables:
GROUP_CLIENT_LIBRARIES_SLACK_GROUP_IDSLACK_APPROVALS_CLIENT_LIBRARIES_CHANNEL_ID
5. Add the release workflow
Copy the release workflow from an existing SDK (e.g., posthog-go) and adapt it:
- Update the environment variable prefix to match your SDK name
- Modify the changelog generation logic if needed for your language's conventions
- Update the version bumping logic for your package manager (npm, pip, etc.)
- Update the publishing steps for your package registry
6. Update the README
Add a section to your SDK's README explaining that releases are semi-automatic and link to the #approvals-client-libraries Slack channel where approval requests are posted.
7. Create required labels
Make sure the repository includes the following labels, they're used to trigger new releases:
releasebump-patchbump-minorbump-major
7. Open a PR
Create a PR with the new release.yml workflow and request a review from @PostHog/group-client-libraries - there's no SDK team at the moment, this is all collaborative work.
Triggering a release
Once set up, releases are triggered by having a release label added to the PR alongside a matching bump-* tag. Once a PR is merged, the environment workflow will kick up and someone from the @PostHog/group-client-libraries team will have to approve it on #approval-support-libraries.
In the future, we'll attempt to use https://github.com/bruits/sampo everywhere to support changesets like we have on
posthog-jswhich means we won't need to worry about thebump-*tags.