Skip to content

Commit 69661a2

Browse files
authored
Automate publishing podspecs to CocoaPods (#313)
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]>
1 parent 65b3aca commit 69661a2

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

.github/CONTRIBUTING.md

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -173,23 +173,12 @@ To update dependencies such as `SwiftProtobuf` in this repository:
173173

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

176-
1. Create a new GitHub release.
177-
2. Update both [`Connect-Swift.podspec`](../Connect-Swift.podspec) and
176+
1. Update both [`Connect-Swift.podspec`](../Connect-Swift.podspec) and
178177
[`Connect-Swift-Mocks.podspec`](../Connect-Swift-Mocks.podspec) to reflect
179-
the newly tagged version.
180-
3. Run `cd Examples/ElizaCocoaPodsApp && pod update` to update the example CocoaPods app.
181-
4. Submit a PR with these changes.
182-
5. Push both specs to CocoaPods:
183-
184-
```sh
185-
pod trunk push Connect-Swift.podspec
186-
pod repo update
187-
pod trunk push Connect-Swift-Mocks.podspec
188-
```
189-
190-
Note: If pushing the mocks podspec fails because CocoaPods cannot find the new
191-
`Connect-Swift` podspec in the specs repo, you may have to wait ~30 min
192-
for it to populate before trying again.
178+
the upcoming version on `main`. In the same PR, update the example CocoaPods
179+
app by running `cd Examples/ElizaCocoaPodsApp && pod install`.
180+
2. Create a new GitHub release/tag after merging these changes.
181+
3. CI will automatically push the updated specs to CocoaPods in its [release job](./workflows/release.yml).
193182

194183
[dco]: https://developercertificate.org
195184
[commit-message]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html

.github/workflows/release.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,17 @@ jobs:
3636
append_body: true
3737
files: |
3838
./.tmp/bin/artifacts/*
39+
publish-podspecs:
40+
runs-on: macos-14
41+
steps:
42+
- uses: actions/checkout@v4
43+
- name: Select Xcode version
44+
# https://github.com/actions/runner-images/blob/main/images/macos/macos-14-arm64-Readme.md#xcode
45+
run: sudo xcode-select --switch /Applications/Xcode_16.app
46+
- name: Publish podspecs to CocoaPods
47+
env:
48+
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
49+
# Note that --synchronous is used since Mocks depends on the primary spec.
50+
run: |
51+
pod trunk push Connect-Swift.podspec --allow-warnings --synchronous
52+
pod trunk push Connect-Swift-Mocks.podspec --allow-warnings --synchronous

0 commit comments

Comments
 (0)