Skip to content

Commit

Permalink
Automate publishing podspecs to CocoaPods (#313)
Browse files Browse the repository at this point in the history
Resolves #311 by
adding a job which runs when new release tags are created and
automatically publishes new releases to CocoaPods. I also updated the
documentation to reflect the new release process.

A sample run can be seen here (against this PR, not a release tag):
https://github.com/connectrpc/connect-swift/actions/runs/11345378532/job/31552734926?pr=313

---------

Signed-off-by: Michael Rebello <[email protected]>
  • Loading branch information
rebello95 authored Oct 15, 2024
1 parent 65b3aca commit 69661a2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
21 changes: 5 additions & 16 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,23 +173,12 @@ To update dependencies such as `SwiftProtobuf` in this repository:

Releases should be tagged in `x.y.z` SemVer format.

1. Create a new GitHub release.
2. Update both [`Connect-Swift.podspec`](../Connect-Swift.podspec) and
1. Update both [`Connect-Swift.podspec`](../Connect-Swift.podspec) and
[`Connect-Swift-Mocks.podspec`](../Connect-Swift-Mocks.podspec) to reflect
the newly tagged version.
3. Run `cd Examples/ElizaCocoaPodsApp && pod update` to update the example CocoaPods app.
4. Submit a PR with these changes.
5. Push both specs to CocoaPods:

```sh
pod trunk push Connect-Swift.podspec
pod repo update
pod trunk push Connect-Swift-Mocks.podspec
```

Note: If pushing the mocks podspec fails because CocoaPods cannot find the new
`Connect-Swift` podspec in the specs repo, you may have to wait ~30 min
for it to populate before trying again.
the upcoming version on `main`. In the same PR, update the example CocoaPods
app by running `cd Examples/ElizaCocoaPodsApp && pod install`.
2. Create a new GitHub release/tag after merging these changes.
3. CI will automatically push the updated specs to CocoaPods in its [release job](./workflows/release.yml).

[dco]: https://developercertificate.org
[commit-message]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,17 @@ jobs:
append_body: true
files: |
./.tmp/bin/artifacts/*
publish-podspecs:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
- name: Select Xcode version
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md#xcode
run: sudo xcode-select --switch /Applications/Xcode_16.app
- name: Publish podspecs to CocoaPods
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
# Note that --synchronous is used since Mocks depends on the primary spec.
run: |
pod trunk push Connect-Swift.podspec --allow-warnings --synchronous
pod trunk push Connect-Swift-Mocks.podspec --allow-warnings --synchronous

0 comments on commit 69661a2

Please sign in to comment.