This repository uses Changesets for version management and an automated GitHub Actions workflow for releases.
When making changes that should be released, add a changeset:
pnpm changesetThis will prompt you to:
- Select the type of version bump (patch, minor, major)
- Write a summary of the changes
The changeset file will be created in the .changeset/ directory.
Create a PR with your changes and the changeset file(s). Add the release label to the PR.
When the PR is merged to main, the release workflow will automatically:
- Check for changesets
- Notify the client libraries team in Slack for approval
- Wait for approval from a maintainer (via GitHub environment protection)
- Once approved:
- Apply changesets and bump the version (in
package.json,PostHogVersion.swift, andPostHog.podspec) - Update the
CHANGELOG.md - Commit the version bump to
main - Create a git tag and GitHub release
- Publish the pod to CocoaPods
- SPM uses the tag name to determine the version, directly from the repo
- Apply changesets and bump the version (in
You can also manually trigger the release workflow from the Actions tab by clicking "Run workflow".
Changesets handles version bumping automatically based on the changesets you create:
- patch: Bug fixes, documentation updates, internal changes (e.g.,
3.41.1→3.41.2) - minor: New features, non-breaking changes (e.g.,
3.41.1→3.42.0) - major: Breaking changes (e.g.,
3.41.1→4.0.0)
For pre-release versions (alpha, beta, RC), you can manually enter pre-release mode:
pnpm changeset pre enter alpha # or beta, rc
pnpm changeset versionTo exit pre-release mode:
pnpm changeset pre exitIf the release workflow fails with "No changesets found", ensure your PR includes at least one changeset file in the .changeset/ directory.
Make sure the PR has the release label applied before merging.
In case of automation failure, you can manually publish:
make releaseCocoaPodsYou'll need to be authenticated with CocoaPods trunk and have push access to the PostHog pod.
The PostHog iOS SDK is published to CocoaPods automatically via GitHub Actions when a release is created. This section covers the management of CocoaPods permissions and tokens.
# Check if you're logged in and your permissions
pod trunk meExpected output should show:
- Name: Your Name
- Email: your.email@posthog.com
- Since: Date
- Pods:
- PostHog
- Sessions:
- Session details...
# Check who owns the PostHog pod
pod trunk info PostHogThis will show:
- Current version
- All owners with push permissions
-
With an existing owner:
# Run this as an existing owner pod trunk add-owner PostHog dev.email@posthog.com -
Verify:
# Check that the new owner was added pod trunk info PostHog
-
With an existing owner:
# Run this as an existing owner pod trunk remove-owner PostHog dev.email@posthog.com -
Verify:
# Check that the new owner was removed pod trunk info PostHog
The COCOAPODS_TRUNK_TOKEN is used in GitHub Actions for automated releases. Here's how to rotate it:
The token is stored as a GitHub secret and used in .github/workflows/release.yml:
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}-
Login to CocoaPods Trunk As the account that will own the token, create a new session with:
pod trunk register your.email@posthog.com 'Your Name' # Verify email if needed
-
Extract the token: The token is stored in
~/.netrcfile:# View your .netrc file grep -A2 'trunk.cocoapods.org' ~/.netrc # or look for the line with `trunk.cocoapods.org` in ~/.netrc cat ~/.netrc
-
Go to GitHub repository settings:
- Request temp access if needed
- Navigate to
https://github.com/organizations/PostHog/settings/secrets/actions - Or: Org → Settings → Secrets and variables → Actions
-
Update the secret:
- Find
COCOAPODS_TRUNK_TOKENin the list - Update the secret
- Find
- Revoke old sessions:
# Clear current sessions (from the user that owned the previous token) pod trunk me clean-sessions
Update ./.github/workflows/release.yml with a comment on the new token owner.
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} # Using @username token