From 5e35b74a9b8ea1064b8458cfca734628a3d27d6f Mon Sep 17 00:00:00 2001 From: Nan Date: Mon, 7 Oct 2024 13:13:20 -0700 Subject: [PATCH] Add release workflow github action --- .github/workflows/cd.yml | 94 ++++++++++++++++++++ iOS_SDK/OneSignalSDK/build_all_frameworks.sh | 2 + iOS_SDK/OneSignalSDK/update_swift_package.sh | 7 +- 3 files changed, 100 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/cd.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 000000000..737b3aff6 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,94 @@ +name: iOS CD + +on: + workflow_dispatch: + inputs: + version: + type: string + description: "The version number of the release" + required: true + release_branch: + type: string + description: "The release branch with bumped version numbers for the release" + required: true + +jobs: + build: + name: Build the binaries for the release and create a PR + runs-on: macos-13 + + steps: + - name: setup xcode + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '15.2' + - name: Checkout OneSignal-iOS-SDK + uses: actions/checkout@v4 + with: + ref: ${{github.event.inputs.release_branch}} + + - name: Install the Apple distribution certificate and provisioning profile + uses: apple-actions/import-codesign-certs@v2 + with: + keychain-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }} + p12-file-base64: ${{ secrets.CERTIFICATES_P12 }} + p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }} + + - name: Install the Apple distribution certificate and provisioning profile + uses: apple-actions/import-codesign-certs@v2 + with: + create-keychain: false # do not create a new keychain for this value + keychain-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }} + p12-file-base64: ${{ secrets.DEV_CERTIFICATES_P12 }} + p12-password: ${{ secrets.DEV_CERTIFICATES_P12_PASSWORD }} + # - name: Bump Version Number + # run: | + - name: Build Binaries + run: | + cd iOS_SDK/OneSignalSDK + chmod +x ./build_all_frameworks.sh + ./build_all_frameworks.sh + shell: bash + - name: Code Sign + run: | + cd iOS_SDK/OneSignalSDK + codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_Core/OneSignalCore.xcframework + codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_Extension/OneSignalExtension.xcframework + codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_Outcomes/OneSignalOutcomes.xcframework + codesign --timestamp -v --sign "Apple Distribution: OneSignal, Inc. (J3J28YJX9L)" OneSignal_XCFramework/OneSignal.xcframework + shell: bash + - name: Update Swift Package + run: | + cd iOS_SDK/OneSignalSDK + chmod +x ./update_swift_package.sh + ./update_swift_package.sh ${{github.event.inputs.version}} + shell: bash + - name: Commit Changes + run: | + git config --local user.email "noreply@onesignal.com" + git config --local user.name "SyncR 🤖" + git add . + git commit -m "Release ${{github.event.inputs.version}}" + + - name: Pushing changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + repository: 'OneSignal/OneSignal-iOS-SDK' + force: true + branch: ${{github.event.inputs.release_branch}} + + - name: "Submitting PR" + uses: octokit/request-action@v2.x + with: + route: POST /repos/{owner}/{repo}/pulls + owner: OneSignal + repo: OneSignal-iOS-SDK + head: ${{github.event.inputs.release_branch}} + base: player-model-main + title: | + "Release ${{github.event.inputs.version}}" + body: | + "Add Release Notes For Review Here" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/iOS_SDK/OneSignalSDK/build_all_frameworks.sh b/iOS_SDK/OneSignalSDK/build_all_frameworks.sh index f8202d7a1..7d01229d0 100755 --- a/iOS_SDK/OneSignalSDK/build_all_frameworks.sh +++ b/iOS_SDK/OneSignalSDK/build_all_frameworks.sh @@ -24,6 +24,8 @@ create_xcframework() { echo "Created ${FRAMEWORK_FOLDER_NAME}" echo "Archiving ${FRAMEWORK_NAME}" + xcodebuild -list + xcodebuild archive ONLY_ACTIVE_ARCH=NO -scheme ${BUILD_SCHEME} -destination="generic/platform=iOS Simulator" -archivePath "${SIMULATOR_ARCHIVE_PATH}" -sdk iphonesimulator SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES xcodebuild archive -scheme ${BUILD_SCHEME} -destination="generic/platform=iOS" -archivePath "${IOS_DEVICE_ARCHIVE_PATH}" -sdk iphoneos SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES diff --git a/iOS_SDK/OneSignalSDK/update_swift_package.sh b/iOS_SDK/OneSignalSDK/update_swift_package.sh index 92b7da22c..c02c00c75 100755 --- a/iOS_SDK/OneSignalSDK/update_swift_package.sh +++ b/iOS_SDK/OneSignalSDK/update_swift_package.sh @@ -22,9 +22,10 @@ SWIFT_PACKAGE_DIRECTORY="${WORKING_DIR}/../.." SWIFT_PACKAGE_PATH="${SWIFT_PACKAGE_DIRECTORY}/Package.swift" -#Ask for the new release version number to be placed in the package URL -echo -e "\033[1mEnter the new SDK release version number\033[0m" -read VERSION_NUMBER +# Ask for the new release version number to be placed in the package URL +# echo -e "\033[1mEnter the new SDK release version number\033[0m" +# read VERSION_NUMBER +VERSION_NUMBER=$1 # Remove the old Zipped XCFramework and create a new Zip echo "Removing old Zipped XCFramework ${FRAMEWORK_ZIP_PATH}"