Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions .github/workflows/publish-pod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Publish to CocoaPods

on:
push:
branches: [ main ]
paths:
- 'Roboflow.podspec'
workflow_dispatch:

jobs:
publish:
runs-on: macos-latest
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all tags

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: false

- name: Install CocoaPods
run: |
gem install cocoapods
pod --version

- name: Extract version from podspec
id: get_version
run: |
VERSION=$(pod ipc spec Roboflow.podspec | jq -r '.version')
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "Detected version: $VERSION"

- name: Validate podspec
run: |
echo "Linting pod..."
pod lib lint

- name: Check if should publish
id: check_publish
run: |
# Check if tag already exists
if git rev-parse "${{ steps.get_version.outputs.VERSION }}" >/dev/null 2>&1; then
echo "Tag ${{ steps.get_version.outputs.VERSION }} already exists - will skip publishing"
echo "SHOULD_PUBLISH=false" >> $GITHUB_OUTPUT
else
echo "Tag ${{ steps.get_version.outputs.VERSION }} does not exist - will proceed with publishing"
echo "SHOULD_PUBLISH=true" >> $GITHUB_OUTPUT
fi

- name: Create and push tag
if: steps.check_publish.outputs.SHOULD_PUBLISH
run: |
echo "Creating tag for version ${{ steps.get_version.outputs.VERSION }}..."
git config user.name github-actions
git config user.email [email protected]
git tag "${{ steps.get_version.outputs.VERSION }}"
git push origin "${{ steps.get_version.outputs.VERSION }}"
echo "Created and pushed tag: ${{ steps.get_version.outputs.VERSION }}"

- name: Publish to CocoaPods
if: steps.check_publish.outputs.SHOULD_PUBLISH
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
run: |
echo "Publishing version ${{ steps.get_version.outputs.VERSION }} to CocoaPods..."
pod trunk push
echo "Successfully published to CocoaPods!"
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,16 @@ The test suite includes:
- **Cross-platform Compatibility**: All tests run without UIKit dependencies, ensuring compatibility across Apple platforms

Test images are located in `Tests/assets/` and the tests automatically download and cache models for testing. All tests are designed to run without requiring additional setup or configuration.



## Publishing a New Version

To publish a new version to CocoaPods:

1. Update the version number in `Roboflow.podspec`
2. Issue a pull request and merge to the `main` branch
3. The GitHub Action will automatically:
- Validate the podspec
- Create and push a git tag for the version
- Publish to CocoaPods trunk