From e38d83fff2f8b7ff25cbf1160cf96e51a09e456e Mon Sep 17 00:00:00 2001 From: emawby Date: Wed, 15 Nov 2023 15:34:57 -0800 Subject: [PATCH 01/12] Add release workflow github action This action is intended to build the binaries needed for an iOS release and open a PR with the changes. Developers will still need to 1. write release notes 2. Create the Github Release after merging the pr 3. Distribute the cocoapod --- .github/workflows/cd.yml | 65 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) 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..c70621b2c --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,65 @@ +name: iOS CD + +on: + workflow_dispatch: + inputs: + version: + type: string + description: "The version number of the release" + required: true +permissions: + contents: write + +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: '14.1' + - name: Checkout OneSignal-iOS-SDK + uses: actions/checkout@v3 + # - name: Bump Version Number + # run: | + + - name: Build Binaries + run: | + chmod +x ./../../iOS_SDK/OneSignalSDK/build_all_frameworks.sh + ./../../iOS_SDK/OneSignalSDK/build_all_frameworks.sh + # chmod +x ./../../iOS_SDK/OneSignalSDK/update_swift_package.sh + # ./../../iOS_SDK/OneSignalSDK/update_swift_package.sh + shell: bash + - name: Commit Changes + env: + version: ${{ inputs.version }} + run: | + git config --local user.email "noreply@onesingal.com" + git config --local user.name "SyncR 🤖" + git add . + git commit -m "Release $version" + + - name: Pushing changes + uses: ad-m/github-push-action@master + with: + # github_token: ${{ secrets.ACTION_TOKEN_PAT }} + repository: 'OneSignal/OneSignal-iOS-SDK' + force: true + branch: ${{ inputs.version }} + + - name: "Submitting PR" + uses: octokit/request-action@v2.x + with: + route: POST /repos/{owner}/{repo}/pulls + owner: OneSignal + repo: OneSignal-iOS-SDK + head: ${{ inputs.version }} + base: main + title: | + "Release ${{ inputs.version }}" + body: | + "Add Release Notes For Review Here" + # env: + # GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN_PAT }} From c3e0cff8e0a83f5a3e6977ca11e562c9dae5a62a Mon Sep 17 00:00:00 2001 From: emawby Date: Wed, 15 Nov 2023 15:40:15 -0800 Subject: [PATCH 02/12] update path --- .github/workflows/cd.yml | 23 +++++++++++++------- iOS_SDK/OneSignalSDK/build_all_frameworks.sh | 2 ++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index c70621b2c..6426e2b56 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -1,6 +1,10 @@ name: iOS CD on: + push: + branches: + - 'add_cd' + workflow_dispatch: inputs: version: @@ -9,6 +13,8 @@ on: required: true permissions: contents: write +env: + version: '5.0.6' jobs: build: @@ -27,14 +33,15 @@ jobs: - name: Build Binaries run: | - chmod +x ./../../iOS_SDK/OneSignalSDK/build_all_frameworks.sh - ./../../iOS_SDK/OneSignalSDK/build_all_frameworks.sh - # chmod +x ./../../iOS_SDK/OneSignalSDK/update_swift_package.sh - # ./../../iOS_SDK/OneSignalSDK/update_swift_package.sh + chmod +x ./iOS_SDK/OneSignalSDK/build_all_frameworks.sh + cd iOS_SDK/OneSignalSDK + ./build_all_frameworks.sh + # chmod +x ./iOS_SDK/OneSignalSDK/update_swift_package.sh + # ./iOS_SDK/OneSignalSDK/update_swift_package.sh shell: bash - name: Commit Changes env: - version: ${{ inputs.version }} + version: $version run: | git config --local user.email "noreply@onesingal.com" git config --local user.name "SyncR 🤖" @@ -47,7 +54,7 @@ jobs: # github_token: ${{ secrets.ACTION_TOKEN_PAT }} repository: 'OneSignal/OneSignal-iOS-SDK' force: true - branch: ${{ inputs.version }} + branch: $version - name: "Submitting PR" uses: octokit/request-action@v2.x @@ -55,10 +62,10 @@ jobs: route: POST /repos/{owner}/{repo}/pulls owner: OneSignal repo: OneSignal-iOS-SDK - head: ${{ inputs.version }} + head: $version base: main title: | - "Release ${{ inputs.version }}" + "Release $version" body: | "Add Release Notes For Review Here" # env: diff --git a/iOS_SDK/OneSignalSDK/build_all_frameworks.sh b/iOS_SDK/OneSignalSDK/build_all_frameworks.sh index 23d6e8451..cc2ca504a 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 From 8b24d36c9d4d3bddc3975d1ce602d456f3add6e1 Mon Sep 17 00:00:00 2001 From: emawby Date: Wed, 15 Nov 2023 16:00:55 -0800 Subject: [PATCH 03/12] add apple signing certificates fix --- .github/workflows/cd.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 6426e2b56..92726ff44 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -27,7 +27,13 @@ jobs: with: xcode-version: '14.1' - name: Checkout OneSignal-iOS-SDK - uses: actions/checkout@v3 + uses: actions/checkout@v4 + + - name: Install the Apple certificate and provisioning profile + uses: apple-actions/import-codesign-certs@v2 + with: + p12-file-base64: ${{ secrets.CERTIFICATES_P12 }} + p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }} # - name: Bump Version Number # run: | From 0ffa8c9d52de1670499d2504d59ee42c8a42f70c Mon Sep 17 00:00:00 2001 From: emawby Date: Fri, 5 Jan 2024 12:05:19 -0800 Subject: [PATCH 04/12] Use standard github token --- .github/workflows/cd.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 92726ff44..e0af2bd73 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -57,7 +57,7 @@ jobs: - name: Pushing changes uses: ad-m/github-push-action@master with: - # github_token: ${{ secrets.ACTION_TOKEN_PAT }} + github_token: ${{ secrets.GITHUB_TOKEN }} repository: 'OneSignal/OneSignal-iOS-SDK' force: true branch: $version @@ -74,5 +74,5 @@ jobs: "Release $version" body: | "Add Release Notes For Review Here" - # env: - # GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN_PAT }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 1d5ce17c65e73d5c1d01895d60f5618a988beb27 Mon Sep 17 00:00:00 2001 From: emawby Date: Fri, 5 Jan 2024 12:07:50 -0800 Subject: [PATCH 05/12] Update Package.swift with the action --- .github/workflows/cd.yml | 10 +++++++--- iOS_SDK/OneSignalSDK/update_swift_package.sh | 5 +++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index e0af2bd73..5529113a1 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -39,11 +39,15 @@ jobs: - name: Build Binaries run: | - chmod +x ./iOS_SDK/OneSignalSDK/build_all_frameworks.sh cd iOS_SDK/OneSignalSDK + chmod +x ./build_all_frameworks.sh ./build_all_frameworks.sh - # chmod +x ./iOS_SDK/OneSignalSDK/update_swift_package.sh - # ./iOS_SDK/OneSignalSDK/update_swift_package.sh + shell: bash + - name: Update Swift Package + run: | + cd iOS_SDK/OneSignalSDK + chmod +x ./update_swift_package.sh + ./update_swift_package.sh $version shell: bash - name: Commit Changes env: diff --git a/iOS_SDK/OneSignalSDK/update_swift_package.sh b/iOS_SDK/OneSignalSDK/update_swift_package.sh index fbfee87dd..9e8b0de6e 100755 --- a/iOS_SDK/OneSignalSDK/update_swift_package.sh +++ b/iOS_SDK/OneSignalSDK/update_swift_package.sh @@ -4,8 +4,9 @@ set -e WORKING_DIR=$(pwd) #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 +# echo -e "\033[1mEnter the new SDK release version number\033[0m" +# read VERSION_NUMBER +VERSION_NUMBER=$1 update_framework() { FRAMEWORK_FOLDER_NAME=$1 From d4d7115fa4c125cf7e339a9a5fea3e8bf2f17eb9 Mon Sep 17 00:00:00 2001 From: Elliot Mawby Date: Fri, 5 Jan 2024 14:48:22 -0800 Subject: [PATCH 06/12] remove permissions --- .github/workflows/cd.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 5529113a1..a1a837407 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -11,8 +11,6 @@ on: type: string description: "The version number of the release" required: true -permissions: - contents: write env: version: '5.0.6' From 7efc91ab36e3df021b623468fd1b95047e3d8ab0 Mon Sep 17 00:00:00 2001 From: Elliot Mawby Date: Fri, 5 Jan 2024 15:00:46 -0800 Subject: [PATCH 07/12] use env.version --- .github/workflows/cd.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index a1a837407..7c7328952 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -48,13 +48,11 @@ jobs: ./update_swift_package.sh $version shell: bash - name: Commit Changes - env: - version: $version run: | - git config --local user.email "noreply@onesingal.com" + git config --local user.email "noreply@onesignal.com" git config --local user.name "SyncR 🤖" git add . - git commit -m "Release $version" + git commit -m "Release ${{env.version}}" - name: Pushing changes uses: ad-m/github-push-action@master @@ -62,7 +60,7 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} repository: 'OneSignal/OneSignal-iOS-SDK' force: true - branch: $version + branch: ${{env.version}} - name: "Submitting PR" uses: octokit/request-action@v2.x @@ -70,10 +68,10 @@ jobs: route: POST /repos/{owner}/{repo}/pulls owner: OneSignal repo: OneSignal-iOS-SDK - head: $version + head: ${{env.version}} base: main title: | - "Release $version" + "Release ${{env.version}}" body: | "Add Release Notes For Review Here" env: From 862294b62dd798898ca7b4455d43dbb7f9bfca8e Mon Sep 17 00:00:00 2001 From: emawby Date: Wed, 17 Jan 2024 11:51:03 -0800 Subject: [PATCH 08/12] commit to a specific release branch --- .github/workflows/cd.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 7c7328952..ec168990f 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -11,8 +11,13 @@ on: 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 env: version: '5.0.6' + release_branch: 'elliot_test_release' jobs: build: @@ -34,7 +39,11 @@ jobs: p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }} # - name: Bump Version Number # run: | - + - name: Checkout release branch + run: | + git config --local user.email "noreply@onesignal.com" + git config --local user.name "SyncR 🤖" + git checkout ${{env.release_branch}} - name: Build Binaries run: | cd iOS_SDK/OneSignalSDK @@ -60,7 +69,7 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} repository: 'OneSignal/OneSignal-iOS-SDK' force: true - branch: ${{env.version}} + branch: ${{env.release_branch}} - name: "Submitting PR" uses: octokit/request-action@v2.x @@ -68,7 +77,7 @@ jobs: route: POST /repos/{owner}/{repo}/pulls owner: OneSignal repo: OneSignal-iOS-SDK - head: ${{env.version}} + head: ${{env.release_branch}} base: main title: | "Release ${{env.version}}" From 0f4df4cbc5e3b156767d7d8eb8359b8f358d01cf Mon Sep 17 00:00:00 2001 From: emawby Date: Wed, 17 Jan 2024 13:51:42 -0800 Subject: [PATCH 09/12] checkout the branch in the checkout step --- .github/workflows/cd.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index ec168990f..59eea7b5d 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -31,6 +31,8 @@ jobs: xcode-version: '14.1' - name: Checkout OneSignal-iOS-SDK uses: actions/checkout@v4 + with: + ref: ${{env.release_branch}} - name: Install the Apple certificate and provisioning profile uses: apple-actions/import-codesign-certs@v2 @@ -39,11 +41,6 @@ jobs: p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }} # - name: Bump Version Number # run: | - - name: Checkout release branch - run: | - git config --local user.email "noreply@onesignal.com" - git config --local user.name "SyncR 🤖" - git checkout ${{env.release_branch}} - name: Build Binaries run: | cd iOS_SDK/OneSignalSDK From 183ef0d35d91c45a6de8112287205b61003f67ef Mon Sep 17 00:00:00 2001 From: emawby Date: Wed, 17 Jan 2024 15:45:24 -0800 Subject: [PATCH 10/12] fix version parse --- .github/workflows/cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 59eea7b5d..0a547c523 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -51,7 +51,7 @@ jobs: run: | cd iOS_SDK/OneSignalSDK chmod +x ./update_swift_package.sh - ./update_swift_package.sh $version + ./update_swift_package.sh ${{env.version}} shell: bash - name: Commit Changes run: | From cf6864b62c7e8a6a2e81492c60c213e69b37b306 Mon Sep 17 00:00:00 2001 From: emawby Date: Wed, 24 Jan 2024 10:50:31 -0800 Subject: [PATCH 11/12] use test branch --- .github/workflows/cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 0a547c523..00ca685cf 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -17,7 +17,7 @@ on: required: true env: version: '5.0.6' - release_branch: 'elliot_test_release' + release_branch: 'test_release_branch' jobs: build: From 7ead9c22be6a6319b882dd42bb65aec5aa0a3665 Mon Sep 17 00:00:00 2001 From: emawby Date: Wed, 24 Jan 2024 11:21:49 -0800 Subject: [PATCH 12/12] remove test data --- .github/workflows/cd.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 00ca685cf..e9c51d4c6 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -1,10 +1,6 @@ name: iOS CD on: - push: - branches: - - 'add_cd' - workflow_dispatch: inputs: version: @@ -15,9 +11,6 @@ on: type: string description: "The release branch with bumped version numbers for the release" required: true -env: - version: '5.0.6' - release_branch: 'test_release_branch' jobs: build: