Update iOS SDK Version #23
This file contains hidden or 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
| name: Update iOS SDK Version | |
| on: | |
| schedule: | |
| - cron: "0 9 * * MON" | |
| workflow_dispatch: | |
| workflow_call: | |
| inputs: | |
| target-version: | |
| description: "Specific iOS SDK version to update to (optional)" | |
| required: false | |
| type: string | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| update-ios-sdk: | |
| name: Update iOS SDK Version | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.AUTOMATION_USER_TOKEN }} | |
| fetch-depth: 0 | |
| - name: Fetch latest iOS SDK version | |
| id: ios-version | |
| run: | | |
| if [ -n "${{ inputs.target-version }}" ]; then | |
| TARGET_VERSION=$(echo "${{ inputs.target-version }}" | sed 's/^v//') | |
| echo "version=$TARGET_VERSION" >> $GITHUB_OUTPUT | |
| echo "Using specified iOS SDK version: $TARGET_VERSION" | |
| else | |
| LATEST_IOS_VERSION=$(curl -s https://api.github.com/repos/DevCycleHQ/ios-client-sdk/releases/latest | jq -r '.tag_name' | sed 's/^v//') | |
| if [ "$LATEST_IOS_VERSION" = "null" ] || [ -z "$LATEST_IOS_VERSION" ]; then | |
| echo "Error: Failed to fetch valid iOS SDK version" | |
| exit 1 | |
| fi | |
| echo "version=$LATEST_IOS_VERSION" >> $GITHUB_OUTPUT | |
| echo "Latest iOS SDK version: $LATEST_IOS_VERSION" | |
| fi | |
| - name: Get current iOS SDK version | |
| id: current-ios | |
| run: | | |
| CURRENT_IOS=$(grep "s.dependency 'DevCycle'" ios/devcycle_flutter_client_sdk.podspec | sed -E "s/.*'DevCycle', '([^']+)'.*/\1/") | |
| echo "version=$CURRENT_IOS" >> $GITHUB_OUTPUT | |
| echo "Current iOS SDK version: $CURRENT_IOS" | |
| - name: Check if iOS update is needed | |
| id: check-update | |
| run: | | |
| if [ "${{ steps.ios-version.outputs.version }}" != "${{ steps.current-ios.outputs.version }}" ]; then | |
| echo "update-needed=true" >> $GITHUB_OUTPUT | |
| echo "iOS SDK update needed: ${{ steps.current-ios.outputs.version }} -> ${{ steps.ios-version.outputs.version }}" | |
| else | |
| echo "update-needed=false" >> $GITHUB_OUTPUT | |
| echo "iOS SDK is already up to date" | |
| fi | |
| - name: Update iOS SDK version | |
| if: steps.check-update.outputs.update-needed == 'true' | |
| run: | | |
| if [ "${{ steps.ios-version.outputs.version }}" = "null" ] || [ -z "${{ steps.ios-version.outputs.version }}" ]; then | |
| echo "Error: Invalid version for podspec update" | |
| exit 1 | |
| fi | |
| sed -i '' -E "s/(s\.dependency 'DevCycle', ')([^']+)(')/\1${{ steps.ios-version.outputs.version }}\3/" ios/devcycle_flutter_client_sdk.podspec | |
| echo "Updated iOS SDK version to ${{ steps.ios-version.outputs.version }}" | |
| - name: Setup Flutter | |
| if: steps.check-update.outputs.update-needed == 'true' | |
| uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046 # v2.19.0 | |
| with: | |
| flutter-version: "3.x" | |
| channel: "stable" | |
| - name: Prepare Flutter | |
| if: steps.check-update.outputs.update-needed == 'true' | |
| run: | | |
| cd example | |
| flutter clean | |
| flutter pub get | |
| - name: Setup CocoaPods | |
| if: steps.check-update.outputs.update-needed == 'true' | |
| run: | | |
| gem install cocoapods --no-document | |
| - name: Update iOS dependency lock file | |
| if: steps.check-update.outputs.update-needed == 'true' | |
| run: | | |
| cd example/ios | |
| rm -f Podfile.lock | |
| rm -rf Pods | |
| pod install --repo-update | |
| echo "✅ Updated iOS Podfile.lock for DevCycle ${{ steps.ios-version.outputs.version }}" | |
| - name: Create Pull Request | |
| if: steps.check-update.outputs.update-needed == 'true' | |
| uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 | |
| with: | |
| token: ${{ secrets.AUTOMATION_USER_TOKEN }} | |
| commit-message: | | |
| chore: update iOS SDK version to ${{ steps.ios-version.outputs.version }} | |
| - iOS SDK: ${{ steps.current-ios.outputs.version }} -> ${{ steps.ios-version.outputs.version }} | |
| title: "chore: update iOS SDK to v${{ steps.ios-version.outputs.version }}" | |
| body: | | |
| ## Summary | |
| This PR updates the DevCycle iOS SDK to the latest version. | |
| ## Changes | |
| - **iOS SDK**: `${{ steps.current-ios.outputs.version }}` → `${{ steps.ios-version.outputs.version }}` | |
| ## Files Modified | |
| - `ios/devcycle_flutter_client_sdk.podspec` - Updated iOS SDK dependency version | |
| - `example/ios/Podfile.lock` - Updated iOS dependency lock file | |
| ## Testing | |
| This PR will be automatically tested by the Flutter SDK Unit Tests workflow which validates: | |
| - Flutter package dependencies | |
| - Code analysis with `flutter analyze` | |
| - Unit tests with `flutter test` | |
| - Package publishing validation with `flutter pub publish --dry-run` | |
| ## Release Notes | |
| See the [iOS SDK release notes](https://github.com/DevCycleHQ/ios-client-sdk/releases/tag/v${{ steps.ios-version.outputs.version }}) for details on what's new in this version. | |
| --- | |
| This PR was automatically generated by the Update iOS SDK Version workflow. | |
| branch: update-ios-sdk-${{ steps.ios-version.outputs.version }} | |
| delete-branch: true | |
| base: main | |
| labels: | | |
| dependencies | |
| ios | |
| automated-pr | |
| - name: Output results | |
| run: | | |
| if [ "${{ steps.check-update.outputs.update-needed }}" = "true" ]; then | |
| echo "::notice title=iOS SDK Updated::Created PR to update iOS SDK to v${{ steps.ios-version.outputs.version }}" | |
| else | |
| echo "::notice title=No Updates::iOS SDK is already up to date (v${{ steps.current-ios.outputs.version }})" | |
| fi |