File tree Expand file tree Collapse file tree 6 files changed +124
-2
lines changed Expand file tree Collapse file tree 6 files changed +124
-2
lines changed Original file line number Diff line number Diff line change 1+ name : CocoaPods
2+
3+ on :
4+ workflow_dispatch :
5+ workflow_call :
6+ release :
7+ types : [published]
8+
9+ jobs :
10+ pod-lint :
11+ runs-on : macos-latest
12+ steps :
13+ - uses : actions/checkout@v3
14+
15+ - name : Install CocoaPods
16+ run : gem install cocoapods
17+
18+ - name : Lint Podspec
19+ run : pod lib lint --allow-warnings
20+
21+ pod-publish :
22+ needs : pod-lint
23+ if : github.event_name == 'release'
24+ runs-on : macos-latest
25+ steps :
26+ - uses : actions/checkout@v3
27+
28+ - name : Install CocoaPods
29+ run : gem install cocoapods
30+
31+ - name : Update CocoaPods Trunk
32+ env :
33+ COCOAPODS_TRUNK_TOKEN : ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
34+ run : |
35+ # Ensure the version in podspec matches the release
36+ ./scripts/update_podspec.sh
37+ # Push the podspec to trunk
38+ pod trunk push --allow-warnings
Original file line number Diff line number Diff line change 2424 run : |
2525 echo "$RELEASE_PLEASE_OUTPUT"
2626
27+ # Update podspec version when a release PR is created or updated
28+ - name : Checkout code if PR is generated/updated
29+ if : ${{ steps.release.outputs.pr }}
30+ uses : actions/checkout@v3
31+ with :
32+ ref : ${{ fromJSON(steps.release.outputs.pr).headBranchName }}
33+
34+ - name : Update podspec version
35+ if : ${{ steps.release.outputs.pr }}
36+ run : |
37+ ./scripts/update_podspec.sh
38+ git config --global user.name "github-actions[bot]"
39+ git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
40+ git add OpenFeature.podspec
41+ git commit -m "chore: update podspec version [skip ci]" || true
42+ git push
43+
2744 # Outputs are namespaced by package when using a manifest in Release Please
2845 outputs :
2946 release_created : ${{ steps.release.outputs['OpenFeature--release_created'] }}
3047 # Version doesn't include `v` as a prefix. This is undocumented
3148 version : ${{ steps.release.outputs['OpenFeature--version'] }}
3249 upload_url : ${{ steps.release.outputs['OpenFeature--upload_url'] }}
50+
51+ # Trigger the CocoaPods workflow when a release is created
52+ cocoapods :
53+ needs : release-please
54+ if : ${{ needs.release-please.outputs.release_created == 'true' }}
55+ uses : ./.github/workflows/cocoapods.yaml
Original file line number Diff line number Diff line change @@ -23,4 +23,19 @@ You can automatically format your code using:
2323
2424``` shell
2525swift test
26- ```
26+ ```
27+
28+ ### Maintaining CocoaPods Integration
29+
30+ The project includes CocoaPods support via the ` OpenFeature.podspec ` file. When making changes:
31+
32+ 1 . The version in the podspec is automatically updated from ` version.txt ` during the release process
33+ 2 . You can manually update the podspec version by running:
34+ ``` shell
35+ ./scripts/update_podspec.sh
36+ ```
37+ 3 . To validate the podspec locally, run:
38+ ``` shell
39+ pod spec lint OpenFeature.podspec --allow-warnings
40+ ```
41+ 4 . The CocoaPods validation and publishing is handled automatically via GitHub workflows on release
Original file line number Diff line number Diff line change 1+ Pod ::Spec . new do |s |
2+ s . name = 'OpenFeature'
3+ s . version = '0.3.0'
4+ s . summary = 'OpenFeature iOS SDK'
5+ s . description = <<-DESC
6+ OpenFeature is an open specification that provides a vendor-agnostic, community-driven API for feature flagging that works with your favorite feature flag management tool or in-house solution.
7+ DESC
8+ s . homepage = 'https://github.com/open-feature/swift-sdk'
9+ s . license = { :type => 'Apache-2.0' , :file => 'LICENSE' }
10+ s . author = { 'OpenFeature' => 'https://github.com/open-feature' }
11+ s . source = { :git => 'https://github.com/open-feature/swift-sdk.git' , :tag => s . version . to_s }
12+
13+ s . ios . deployment_target = '14.0'
14+ s . osx . deployment_target = '11.0'
15+ s . swift_version = '5.5'
16+
17+ s . source_files = 'Sources/OpenFeature/**/*'
18+
19+ s . frameworks = 'Foundation'
20+ end
Original file line number Diff line number Diff line change @@ -71,6 +71,20 @@ and in the target dependencies section add:
7171.product (name : " OpenFeature" , package : " swift-sdk" ),
7272```
7373
74+ #### CocoaPods
75+
76+ If you manage dependencies through CocoaPods, add the following to your Podfile:
77+
78+ ``` ruby
79+ pod ' OpenFeature' , ' ~> 0.3.0'
80+ ```
81+
82+ Then, run:
83+
84+ ``` bash
85+ pod install
86+ ```
87+
7488### Usage
7589
7690``` swift
@@ -194,7 +208,7 @@ A shutdown function is not yet available in the iOS SDK.
194208### Develop a provider
195209
196210To develop a provider, you need to create a new project and include the OpenFeature SDK as a dependency.
197- You’ ll then need to write the provider by implementing the ` FeatureProvider ` interface exported by the OpenFeature SDK.
211+ You' ll then need to write the provider by implementing the ` FeatureProvider ` interface exported by the OpenFeature SDK.
198212
199213``` swift
200214import OpenFeature
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Exit if any command fails
4+ set -e
5+
6+ # Get the version from version.txt
7+ VERSION=$( cat version.txt | tr -d ' \n' )
8+
9+ # Update the version in the podspec
10+ sed -i ' ' " s/s.version.*=.*/s.version = '$VERSION '/g" OpenFeature.podspec
11+
12+ echo " Updated OpenFeature.podspec to version $VERSION "
You can’t perform that action at this time.
0 commit comments