-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Ben White <ben@posthog.com>
- Loading branch information
1 parent
bec3aff
commit 19064a4
Showing
11 changed files
with
101 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: 'Release' | ||
on: | ||
release: | ||
# runs for stable and pre-releases | ||
types: [published] | ||
|
||
jobs: | ||
cancel-previous-workflow: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Cancel Previous Runs | ||
uses: styfle/cancel-workflow-action@01ce38bf961b4e243a6342cbade0dbc8ba3f0432 # pin@0.12.0 | ||
with: | ||
access_token: ${{ github.token }} | ||
|
||
release: | ||
name: Release | ||
runs-on: macos-latest | ||
env: | ||
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} # Using Manoel's token for now | ||
|
||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Cocoapods | ||
run: gem install cocoapods | ||
|
||
- name: Update version | ||
run: ./scripts/bump-version.sh ${{ github.event.release.tag_name }} | ||
|
||
- name: Commit & push | ||
run: | | ||
echo "Tag name from github.ref_name: ${{ github.event.release.target_commitish }}" | ||
./scripts/commit-code.sh ${{ github.event.release.target_commitish }} | ||
- name: Release | ||
run: make releaseCocoaPods |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import Foundation | ||
import Nimble | ||
import Quick | ||
import Foundation | ||
|
||
@testable import PostHog | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,14 @@ | ||
# Releasing | ||
|
||
1. Update the version in `PostHog.podspec`, `PostHog/Info.plist`, and `version` in `PostHog/Classes/PHGPostHog.m` to the next release version. | ||
2. Update the `CHANGELOG.md` for the impending release. | ||
3. `git commit -am "Prepare for release X.Y.Z."` (where X.Y.Z is the new version). | ||
4. `git tag -a X.Y.Z -m "Version X.Y.Z"` (where X.Y.Z is the new version). | ||
5. `git push && git push --tags`. | ||
6. `pod trunk push PostHog.podspec --allow-warnings`. | ||
7. Go to [GH Releases](https://github.com/PostHog/posthog-ios/releases) and create a new release from the tag you just pushed. Copy the changelog entry into the description and publish the release. | ||
|
||
## On Apple Silicon | ||
|
||
Run this first: | ||
|
||
```bash | ||
sudo arch -x86_64 gem install ffi | ||
arch -x86_64 pod install | ||
``` | ||
|
||
Then, [configure XCode CLI tools](https://stackoverflow.com/questions/29108172/how-do-i-fix-the-xcrun-unable-to-find-simctl-error). | ||
|
||
Finally, prepend `arch -x86_64` to the pod command in the steps above. | ||
Releasing | ||
========= | ||
|
||
1. Update the CHANGELOG.md with the version and date | ||
2. Go to [GH Releases](https://github.com/PostHog/posthog-ios/releases) | ||
3. Choose a tag name (e.g. `3.0.0`), this is the version number of the release. | ||
1. Preview releases follow the pattern `3.0.0-alpha.1`, `3.0.0-beta.1`, `3.0.0-RC.1` | ||
4. Choose a release name (e.g. `3.0.0`), ideally it matches the above. | ||
5. Write a description of the release. | ||
6. Publish the release. | ||
7. GH Action (release.yml) is doing everything else automatically. | ||
1. SPM uses the tag name to determine the version, directly from the repo. | ||
2. CocoaPods are published. | ||
8. Done. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
# ./scripts/bump-version.sh <new version> | ||
# eg ./scripts/bump-version.sh "3.0.0-alpha.1" | ||
|
||
set -eux | ||
|
||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
cd $SCRIPT_DIR/.. | ||
|
||
NEW_VERSION="$1" | ||
|
||
# Replace `postHogVersion` with the given version | ||
perl -pi -e "s/postHogVersion = \".*\"/postHogVersion = \"$NEW_VERSION\"/" PostHog/PostHogVersion.swift | ||
|
||
# Replace `s.version` with the given version | ||
perl -pi -e "s/s.version = \".*\"/s.version = \"$NEW_VERSION\"/" PostHog.podspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
cd $SCRIPT_DIR/.. | ||
|
||
GITHUB_BRANCH="${1}" | ||
|
||
if [[ $(git status) == *"nothing to commit"* ]]; then | ||
echo "Nothing to commit." | ||
else | ||
echo "Going to push the changes." | ||
git config --global user.name 'PostHog Github Bot' | ||
git config --global user.email 'github-bot@posthog.com' | ||
git fetch | ||
git checkout ${GITHUB_BRANCH} | ||
git commit -am "Update version" | ||
git push --set-upstream origin ${GITHUB_BRANCH} | ||
fi |