From 89581194b72784b7b2f9848a4d2ccb8d48c18342 Mon Sep 17 00:00:00 2001 From: Neal Xu Date: Mon, 8 Jan 2024 20:40:18 +0800 Subject: [PATCH] feat: add android release (#56) --- .github/workflows/build-release-android.yml | 263 ++++++++-------- .github/workflows/build-release-ios.yml | 317 ++++++++++---------- 2 files changed, 295 insertions(+), 285 deletions(-) diff --git a/.github/workflows/build-release-android.yml b/.github/workflows/build-release-android.yml index 7a09f491..aafd2723 100644 --- a/.github/workflows/build-release-android.yml +++ b/.github/workflows/build-release-android.yml @@ -6,136 +6,147 @@ on: env: CARGO_TERM_COLOR: always - ORG_GRADLE_PROJECT_sonatypeUsername : ${{ secrets.OSSRH_USERNAME }} - ORG_GRADLE_PROJECT_sonatypePassword : ${{ secrets.OSSRH_PASSWORD }} - ORG_GRADLE_PROJECT_signingKey : ${{ secrets.SIGNING_KEY }} - ORG_GRADLE_PROJECT_signingPassword : ${{ secrets.SIGNING_SECRET }} - + ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }} + ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_PASSWORD }} + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_SECRET }} + +permissions: + contents: write + jobs: build: name: Build Android Release if: github.event.review.state == 'approved' runs-on: macos-latest steps: - - name: Get the latest commit SHA - id: sha - uses: actions/github-script@v6 - with: - result-encoding: string - script: | - const { owner, repo, number } = context.issue - const pr = await github.rest.pulls.get({ - owner, - repo, - pull_number: number, - }) - return pr.data.head.sha - - - name: Checkout repository - uses: actions/checkout@v3 - with: - ref: ${{ steps.sha.outputs.result }} - fetch-depth: 5 - - - name: Cache - uses: actions/cache@v2 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - ~/.rustup - target - key: ${{ runner.os }}-nightly - - - name: Install Rust - run: | - rustup toolchain install nightly-2022-10-31 - rustup default nightly-2022-10-31-x86_64-apple-darwin - rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android - rustup show - - # - name: Install dependent - # run: | - # sudo apt-get install -y libusb-dev libusb-1.0-0-dev libftdi1-dev libudev-dev - # sudo apt-get install -y protobuf-compiler libprotobuf-dev - - - name: Install dependency - run: | - brew install protobuf - - - name: Setup Android SDK - uses: android-actions/setup-android@v2 - - - name: Install Android Tools - run: sdkmanager "build-tools;29.0.3" "platforms;android-31" "ndk;25.2.9519653" - - - name: Configure Rust Config File - run: | - echo '[target.armv7-linux-androideabi]' >> ~/.cargo/config - echo 'ar = "/Users/runner/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar"' >> ~/.cargo/config - echo 'linker = "/Users/runner/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi22-clang"' >> ~/.cargo/config - echo '[target.aarch64-linux-android]' >> ~/.cargo/config - echo 'ar = "/Users/runner/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar"' >> ~/.cargo/config - echo 'linker = "/Users/runner/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android29-clang"' >> ~/.cargo/config - echo '[target.i686-linux-android]' >> ~/.cargo/config - echo 'ar = "/Users/runner/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar"' >> ~/.cargo/config - echo 'linker = "/Users/runner/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android29-clang"' >> ~/.cargo/config - echo '[target.x86_64-linux-android]' >> ~/.cargo/config - echo 'ar = "/Users/runner/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar"' >> ~/.cargo/config - echo 'linker = "/Users/runner/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/x86_64-linux-android29-clang"' >> ~/.cargo/config - cat ~/.cargo/config - - - name: Build TCX And IKC - run: | - pushd ${{github.workspace}}/script - ./build-android.sh - popd - - - name: Setup Gradle - uses: gradle/gradle-build-action@v2 - with: - gradle-version: 7.0.1 - - - name: Read VERSION file - id: getversion - run: echo "version=$(cat VERSION)+$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - - - name: Get commits - id: getcommits - shell: bash - run: | - OUTPUT="$(git log -n 5 --pretty=format:"%s")" - echo ::set-output name=commits::"${OUTPUT}" - - - name: Publish - id: publish - run: | - pushd ${{github.workspace}}/publish/android - ./gradlew assemble - echo "tokencore_sha256=$(shasum -a 256 ${{github.workspace}}/publish/android/tokencore/build/outputs/aar/tokencore-release.aar | awk '{ print $1 }')" >> $GITHUB_OUTPUT - echo "tokencore-release.aar sha256: $(shasum -a 256 ${{github.workspace}}/publish/android/tokencore/build/outputs/aar/tokencore-release.aar | awk '{ print $1 }')" - VERSION=${{steps.getversion.outputs.version}} ./gradlew publishToSonatype closeSonatypeStagingRepository - popd - - - - name: Send custom JSON data to Slack workflow - id: slack - uses: slackapi/slack-github-action@v1.23.0 - with: - # For posting a rich message using Block Kit - payload: | - { - "text": "New build of android-token-core: ${{ job.status }}\nVERSION: ${{ steps.getversion.outputs.version }}\nTokenCore Sha256: ${{ steps.publish.outputs.tokencore_sha256 }}\nCheck more: ${{ github.event.pull_request.html_url || github.event.head_commit.url }}\nCommits:\n${{ steps.getcommits.outputs.commits }}", - "blocks": [ - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "New build of android-token-core: ${{ job.status }}\nVERSION: ${{ steps.getversion.outputs.version }}\nTokenCore Sha256: ${{ steps.publish.outputs.tokencore_sha256 }}\nCheck more: ${{ github.event.pull_request.html_url || github.event.head_commit.url }}\nCommits:\n${{ steps.getcommits.outputs.commits }}" + - name: Get the latest commit SHA + id: sha + uses: actions/github-script@v6 + with: + result-encoding: string + script: | + const { owner, repo, number } = context.issue + const pr = await github.rest.pulls.get({ + owner, + repo, + pull_number: number, + }) + return pr.data.head.sha + + - name: Checkout repository + uses: actions/checkout@v3 + with: + ref: ${{ steps.sha.outputs.result }} + fetch-depth: 5 + + - name: Cache + uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + ~/.rustup + target + key: ${{ runner.os }}-nightly + + - name: Install Rust + run: | + rustup toolchain install nightly-2022-10-31 + rustup default nightly-2022-10-31-x86_64-apple-darwin + rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android + rustup show + + # - name: Install dependent + # run: | + # sudo apt-get install -y libusb-dev libusb-1.0-0-dev libftdi1-dev libudev-dev + # sudo apt-get install -y protobuf-compiler libprotobuf-dev + + - name: Install dependency + run: | + brew install protobuf + + - name: Setup Android SDK + uses: android-actions/setup-android@v2 + + - name: Install Android Tools + run: sdkmanager "build-tools;29.0.3" "platforms;android-31" "ndk;25.2.9519653" + + - name: Configure Rust Config File + run: | + echo '[target.armv7-linux-androideabi]' >> ~/.cargo/config + echo 'ar = "/Users/runner/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar"' >> ~/.cargo/config + echo 'linker = "/Users/runner/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/armv7a-linux-androideabi22-clang"' >> ~/.cargo/config + echo '[target.aarch64-linux-android]' >> ~/.cargo/config + echo 'ar = "/Users/runner/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar"' >> ~/.cargo/config + echo 'linker = "/Users/runner/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/aarch64-linux-android29-clang"' >> ~/.cargo/config + echo '[target.i686-linux-android]' >> ~/.cargo/config + echo 'ar = "/Users/runner/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar"' >> ~/.cargo/config + echo 'linker = "/Users/runner/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/i686-linux-android29-clang"' >> ~/.cargo/config + echo '[target.x86_64-linux-android]' >> ~/.cargo/config + echo 'ar = "/Users/runner/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/llvm-ar"' >> ~/.cargo/config + echo 'linker = "/Users/runner/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/x86_64-linux-android29-clang"' >> ~/.cargo/config + cat ~/.cargo/config + + - name: Build TCX And IKC + run: | + pushd ${{github.workspace}}/script + ./build-android.sh + popd + + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + with: + gradle-version: 7.0.1 + + - name: Read VERSION file + id: getversion + run: echo "version=$(cat VERSION)+$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + + - name: Get commits + id: getcommits + shell: bash + run: | + OUTPUT="$(git log -n 5 --pretty=format:"%s")" + echo ::set-output name=commits::"${OUTPUT}" + + - name: Publish + id: publish + run: | + pushd ${{github.workspace}}/publish/android + ./gradlew assemble + echo "tokencore_sha256=$(shasum -a 256 ${{github.workspace}}/publish/android/tokencore/build/outputs/aar/tokencore-release.aar | awk '{ print $1 }')" >> $GITHUB_OUTPUT + echo "tokencore-release.aar sha256: $(shasum -a 256 ${{github.workspace}}/publish/android/tokencore/build/outputs/aar/tokencore-release.aar | awk '{ print $1 }')" + cp ${{github.workspace}}/publish/android/tokencore/build/outputs/aar/tokencore-release.aar ${{github.workspace}}/tokencore-${{ steps.getversion.outputs.version }}.aar + popd + + - name: Release + uses: softprops/action-gh-release@v1 + with: + name: "Release ${{ steps.getversion.outputs.version }}" + tag_name: "v${{ steps.getversion.outputs.version }}" + generate_release_notes: true + files: | + tokencore-${{ steps.getversion.outputs.version }}.aar + + - name: Send custom JSON data to Slack workflow + id: slack + uses: slackapi/slack-github-action@v1.23.0 + with: + # For posting a rich message using Block Kit + payload: | + { + "text": "New build of android-token-core: ${{ job.status }}\nVERSION: ${{ steps.getversion.outputs.version }}\nTokenCore Sha256: ${{ steps.publish.outputs.tokencore_sha256 }}\nCheck more: ${{ github.event.pull_request.html_url || github.event.head_commit.url }}\nCommits:\n${{ steps.getcommits.outputs.commits }}", + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "New build of android-token-core: ${{ job.status }}\nVERSION: ${{ steps.getversion.outputs.version }}\nTokenCore Sha256: ${{ steps.publish.outputs.tokencore_sha256 }}\nCheck more: ${{ github.event.pull_request.html_url || github.event.head_commit.url }}\nCommits:\n${{ steps.getcommits.outputs.commits }}" + } } - } - ] - } - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} - SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK + ] + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK diff --git a/.github/workflows/build-release-ios.yml b/.github/workflows/build-release-ios.yml index 2c41b2bd..15ef5702 100644 --- a/.github/workflows/build-release-ios.yml +++ b/.github/workflows/build-release-ios.yml @@ -16,163 +16,162 @@ jobs: if: github.event.review.state == 'approved' runs-on: macos-latest steps: - - name: Get the latest commit SHA - id: sha - uses: actions/github-script@v6 - with: - result-encoding: string - script: | - const { owner, repo, number } = context.issue - const pr = await github.rest.pulls.get({ - owner, - repo, - pull_number: number, - }) - return pr.data.head.sha - - - name: Checkout repository - uses: actions/checkout@v3 - with: - ref: ${{ steps.sha.outputs.result }} - fetch-depth: 5 - - - name: Cache - uses: actions/cache@v2 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - ~/.rustup - target - key: macos-latest-nightly - - - name: Install Rust - run: | - rustup toolchain install nightly-2022-10-31 - rustup default nightly-2022-10-31-x86_64-apple-darwin - rustup target add aarch64-apple-ios x86_64-apple-ios - rustup show - cargo install cargo-lipo - brew install protobuf - - - name: Read VERSION file - id: getversion - run: | - echo "version=$(cat VERSION)+$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - echo "tag_name=$(cat VERSION)" >> $GITHUB_OUTPUT - echo "short_commit=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - - - name: Get commits - id: getcommits - shell: bash - run: | - OUTPUT="$(git log -n 5 --pretty=format:"%s")" - echo ::set-output name=commits::"${OUTPUT}" - - - - name: Build And Publish - id: build - run: | - pushd ./imkey-core/ikc - cargo lipo --release --targets aarch64-apple-ios x86_64-apple-ios - cbindgen ./src/lib.rs -l c > ${{github.workspace}}/target/connector.h - popd - - pushd ./token-core/tcx - cargo lipo --release --targets aarch64-apple-ios x86_64-apple-ios - cbindgen ./src/lib.rs -l c > ${{github.workspace}}/target/tcx.h - popd - - LIBS_IKC=./imkey-core/mobile-sdk/imKeyCoreX/imKeyCoreX - LIBS_TCX=./token-core/tcx-examples/TokenCoreX/TokenCoreX - cp ./target/universal/release/libconnector.a $LIBS_IKC/libconnector.a - cp ./target/universal/release/libtcx.a $LIBS_TCX/libtcx.a - cp ./target/connector.h $LIBS_IKC/connector.h - cp ./target/tcx.h $LIBS_TCX/tcx.h - if [ -d "./ios-release" ]; then - rm -rf ./ios-release - fi - - BUILD_DIR=./Products - BUILD_ROOT=./Products - SYMROOT=./Products - BUILD_PRODUCTS=./Products - CONFIGURATION=Release - PROJECT_NAME_IKC=imKeyCoreX - PROJECT_NAME_TCX=TokenCoreX - - pushd ./imkey-core/mobile-sdk/imKeyCoreX - mkdir -p $BUILD_DIR - UNIVERSAL_OUTPUTFOLDER=$BUILD_DIR/$CONFIGURATION-Universal - mkdir -p $UNIVERSAL_OUTPUTFOLDER - - xcodebuild -target $PROJECT_NAME_IKC ONLY_ACTIVE_ARCH=NO -configuration $CONFIGURATION -sdk iphoneos BUILD_DIR=$BUILD_DIR BUILD_ROOT=$BUILD_ROOT build - xcodebuild -target $PROJECT_NAME_IKC -configuration Debug -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR=$BUILD_DIR BUILD_ROOT=$BUILD_ROOT EXCLUDED_ARCHS=arm64 build - cp -R $BUILD_DIR/$CONFIGURATION-iphoneos/$PROJECT_NAME_IKC.framework $UNIVERSAL_OUTPUTFOLDER/ - lipo -create -output $UNIVERSAL_OUTPUTFOLDER/$PROJECT_NAME_IKC.framework/$PROJECT_NAME_IKC $BUILD_PRODUCTS/Debug-iphonesimulator/$PROJECT_NAME_IKC.framework/$PROJECT_NAME_IKC $BUILD_DIR/$CONFIGURATION-iphoneos/$PROJECT_NAME_IKC.framework/$PROJECT_NAME_IKC - - cp -R $UNIVERSAL_OUTPUTFOLDER/ ../../ios-release - rm -rf $UNIVERSAL_OUTPUTFOLDER - popd - - pushd ./imkey-core/ios-release - PACKAGE_NAME=ios-ikc-${{ steps.getversion.outputs.version }}.zip - zip -q -r $PACKAGE_NAME . - echo "imkeycorex_sha256=$(shasum -a 256 $PACKAGE_NAME | awk '{ print $1 }')" >> $GITHUB_OUTPUT - echo "imKeyCoreX sha256: $(shasum -a 256 $PACKAGE_NAME | awk '{ print $1 }')" - cp $PACKAGE_NAME ../../ - popd - - pushd ./token-core/tcx-examples/TokenCoreX - mkdir -p $BUILD_DIR - UNIVERSAL_OUTPUTFOLDER=$BUILD_DIR/$CONFIGURATION-Universal - mkdir -p $UNIVERSAL_OUTPUTFOLDER - - xcodebuild -target $PROJECT_NAME_TCX ONLY_ACTIVE_ARCH=NO -configuration $CONFIGURATION -sdk iphoneos BUILD_DIR=$BUILD_DIR BUILD_ROOT=$BUILD_ROOT build - xcodebuild -target $PROJECT_NAME_TCX -configuration Debug -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR=$BUILD_DIR BUILD_ROOT=$BUILD_ROOT EXCLUDED_ARCHS=arm64 build - cp -R $BUILD_DIR/$CONFIGURATION-iphoneos/$PROJECT_NAME_TCX.framework $UNIVERSAL_OUTPUTFOLDER/ - lipo -create -output $UNIVERSAL_OUTPUTFOLDER/$PROJECT_NAME_TCX.framework/$PROJECT_NAME_TCX $BUILD_PRODUCTS/Debug-iphonesimulator/$PROJECT_NAME_TCX.framework/$PROJECT_NAME_TCX $BUILD_DIR/$CONFIGURATION-iphoneos/$PROJECT_NAME_TCX.framework/$PROJECT_NAME_TCX - - cp -R $UNIVERSAL_OUTPUTFOLDER/ ../../ios-release - rm -rf $UNIVERSAL_OUTPUTFOLDER - popd - - pushd ./token-core/ios-release - PACKAGE_NAME=ios-tcx-${{ steps.getversion.outputs.version }}.zip - zip -q -r $PACKAGE_NAME . - echo "tokencorex_sha256=$(shasum -a 256 $PACKAGE_NAME | awk '{ print $1 }')" >> $GITHUB_OUTPUT - echo "TokenCoreX sha256: $(shasum -a 256 $PACKAGE_NAME | awk '{ print $1 }')" - cp $PACKAGE_NAME ../../ - popd - - - name: Release - uses: softprops/action-gh-release@v1 - with: - name: "Release ${{ steps.getversion.outputs.version }}" - tag_name: "v${{ steps.getversion.outputs.version }}" - generate_release_notes: true - files: | - ios-ikc-${{ steps.getversion.outputs.version }}.zip - ios-tcx-${{ steps.getversion.outputs.version }}.zip - - - name: Send custom JSON data to Slack workflow - id: slack - uses: slackapi/slack-github-action@v1.23.0 - with: - # For posting a rich message using Block Kit - payload: | - { - "text": "New build of ios-token-core: ${{ job.status }}\nVERSION: ${{ steps.getversion.outputs.version }}\nimKey Core X Sha256: ${{ steps.build.outputs.imkeycorex_sha256 }}\nToken Core X Sha256: ${{ steps.build.outputs.tokencorex_sha256 }}\nCheck more: ${{ github.event.pull_request.html_url || github.event.head_commit.url }}\nCommits:\n${{ steps.getcommits.outputs.commits }}", - "blocks": [ - { - "type": "section", - "text": { - "type": "mrkdwn", - "text": "New build of ios-token-core: ${{ job.status }}\nVERSION: ${{ steps.getversion.outputs.version }}\nimKey Core X Sha256: ${{ steps.build.outputs.imkeycorex_sha256 }}\nToken Core X Sha256: ${{ steps.build.outputs.tokencorex_sha256 }}\nCheck more: ${{ github.event.pull_request.html_url || github.event.head_commit.url }}\nCommits:\n${{ steps.getcommits.outputs.commits }}" + - name: Get the latest commit SHA + id: sha + uses: actions/github-script@v6 + with: + result-encoding: string + script: | + const { owner, repo, number } = context.issue + const pr = await github.rest.pulls.get({ + owner, + repo, + pull_number: number, + }) + return pr.data.head.sha + + - name: Checkout repository + uses: actions/checkout@v3 + with: + ref: ${{ steps.sha.outputs.result }} + fetch-depth: 5 + + - name: Cache + uses: actions/cache@v2 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + ~/.rustup + target + key: macos-latest-nightly + + - name: Install Rust + run: | + rustup toolchain install nightly-2022-10-31 + rustup default nightly-2022-10-31-x86_64-apple-darwin + rustup target add aarch64-apple-ios x86_64-apple-ios + rustup show + cargo install cargo-lipo + brew install protobuf + + - name: Read VERSION file + id: getversion + run: | + echo "version=$(cat VERSION)+$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + echo "tag_name=$(cat VERSION)" >> $GITHUB_OUTPUT + echo "short_commit=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + + - name: Get commits + id: getcommits + shell: bash + run: | + OUTPUT="$(git log -n 5 --pretty=format:"%s")" + echo ::set-output name=commits::"${OUTPUT}" + + - name: Build And Publish + id: build + run: | + pushd ./imkey-core/ikc + cargo lipo --release --targets aarch64-apple-ios x86_64-apple-ios + cbindgen ./src/lib.rs -l c > ${{github.workspace}}/target/connector.h + popd + + pushd ./token-core/tcx + cargo lipo --release --targets aarch64-apple-ios x86_64-apple-ios + cbindgen ./src/lib.rs -l c > ${{github.workspace}}/target/tcx.h + popd + + LIBS_IKC=./imkey-core/mobile-sdk/imKeyCoreX/imKeyCoreX + LIBS_TCX=./token-core/tcx-examples/TokenCoreX/TokenCoreX + cp ./target/universal/release/libconnector.a $LIBS_IKC/libconnector.a + cp ./target/universal/release/libtcx.a $LIBS_TCX/libtcx.a + cp ./target/connector.h $LIBS_IKC/connector.h + cp ./target/tcx.h $LIBS_TCX/tcx.h + if [ -d "./ios-release" ]; then + rm -rf ./ios-release + fi + + BUILD_DIR=./Products + BUILD_ROOT=./Products + SYMROOT=./Products + BUILD_PRODUCTS=./Products + CONFIGURATION=Release + PROJECT_NAME_IKC=imKeyCoreX + PROJECT_NAME_TCX=TokenCoreX + + pushd ./imkey-core/mobile-sdk/imKeyCoreX + mkdir -p $BUILD_DIR + UNIVERSAL_OUTPUTFOLDER=$BUILD_DIR/$CONFIGURATION-Universal + mkdir -p $UNIVERSAL_OUTPUTFOLDER + + xcodebuild -target $PROJECT_NAME_IKC ONLY_ACTIVE_ARCH=NO -configuration $CONFIGURATION -sdk iphoneos BUILD_DIR=$BUILD_DIR BUILD_ROOT=$BUILD_ROOT build + xcodebuild -target $PROJECT_NAME_IKC -configuration Debug -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR=$BUILD_DIR BUILD_ROOT=$BUILD_ROOT EXCLUDED_ARCHS=arm64 build + cp -R $BUILD_DIR/$CONFIGURATION-iphoneos/$PROJECT_NAME_IKC.framework $UNIVERSAL_OUTPUTFOLDER/ + lipo -create -output $UNIVERSAL_OUTPUTFOLDER/$PROJECT_NAME_IKC.framework/$PROJECT_NAME_IKC $BUILD_PRODUCTS/Debug-iphonesimulator/$PROJECT_NAME_IKC.framework/$PROJECT_NAME_IKC $BUILD_DIR/$CONFIGURATION-iphoneos/$PROJECT_NAME_IKC.framework/$PROJECT_NAME_IKC + + cp -R $UNIVERSAL_OUTPUTFOLDER/ ../../ios-release + rm -rf $UNIVERSAL_OUTPUTFOLDER + popd + + pushd ./imkey-core/ios-release + PACKAGE_NAME=ios-ikc-${{ steps.getversion.outputs.version }}.zip + zip -q -r $PACKAGE_NAME . + echo "imkeycorex_sha256=$(shasum -a 256 $PACKAGE_NAME | awk '{ print $1 }')" >> $GITHUB_OUTPUT + echo "imKeyCoreX sha256: $(shasum -a 256 $PACKAGE_NAME | awk '{ print $1 }')" + cp $PACKAGE_NAME ../../ + popd + + pushd ./token-core/tcx-examples/TokenCoreX + mkdir -p $BUILD_DIR + UNIVERSAL_OUTPUTFOLDER=$BUILD_DIR/$CONFIGURATION-Universal + mkdir -p $UNIVERSAL_OUTPUTFOLDER + + xcodebuild -target $PROJECT_NAME_TCX ONLY_ACTIVE_ARCH=NO -configuration $CONFIGURATION -sdk iphoneos BUILD_DIR=$BUILD_DIR BUILD_ROOT=$BUILD_ROOT build + xcodebuild -target $PROJECT_NAME_TCX -configuration Debug -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR=$BUILD_DIR BUILD_ROOT=$BUILD_ROOT EXCLUDED_ARCHS=arm64 build + cp -R $BUILD_DIR/$CONFIGURATION-iphoneos/$PROJECT_NAME_TCX.framework $UNIVERSAL_OUTPUTFOLDER/ + lipo -create -output $UNIVERSAL_OUTPUTFOLDER/$PROJECT_NAME_TCX.framework/$PROJECT_NAME_TCX $BUILD_PRODUCTS/Debug-iphonesimulator/$PROJECT_NAME_TCX.framework/$PROJECT_NAME_TCX $BUILD_DIR/$CONFIGURATION-iphoneos/$PROJECT_NAME_TCX.framework/$PROJECT_NAME_TCX + + cp -R $UNIVERSAL_OUTPUTFOLDER/ ../../ios-release + rm -rf $UNIVERSAL_OUTPUTFOLDER + popd + + pushd ./token-core/ios-release + PACKAGE_NAME=ios-tcx-${{ steps.getversion.outputs.version }}.zip + zip -q -r $PACKAGE_NAME . + echo "tokencorex_sha256=$(shasum -a 256 $PACKAGE_NAME | awk '{ print $1 }')" >> $GITHUB_OUTPUT + echo "TokenCoreX sha256: $(shasum -a 256 $PACKAGE_NAME | awk '{ print $1 }')" + cp $PACKAGE_NAME ../../ + popd + + - name: Release + uses: softprops/action-gh-release@v1 + with: + name: "Release ${{ steps.getversion.outputs.version }}" + tag_name: "v${{ steps.getversion.outputs.version }}" + generate_release_notes: true + files: | + ios-ikc-${{ steps.getversion.outputs.version }}.zip + ios-tcx-${{ steps.getversion.outputs.version }}.zip + + - name: Send custom JSON data to Slack workflow + id: slack + uses: slackapi/slack-github-action@v1.23.0 + with: + # For posting a rich message using Block Kit + payload: | + { + "text": "New build of ios-token-core: ${{ job.status }}\nVERSION: ${{ steps.getversion.outputs.version }}\nimKey Core X Sha256: ${{ steps.build.outputs.imkeycorex_sha256 }}\nToken Core X Sha256: ${{ steps.build.outputs.tokencorex_sha256 }}\nCheck more: ${{ github.event.pull_request.html_url || github.event.head_commit.url }}\nCommits:\n${{ steps.getcommits.outputs.commits }}", + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "New build of ios-token-core: ${{ job.status }}\nVERSION: ${{ steps.getversion.outputs.version }}\nimKey Core X Sha256: ${{ steps.build.outputs.imkeycorex_sha256 }}\nToken Core X Sha256: ${{ steps.build.outputs.tokencorex_sha256 }}\nCheck more: ${{ github.event.pull_request.html_url || github.event.head_commit.url }}\nCommits:\n${{ steps.getcommits.outputs.commits }}" + } } - } - ] - } - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} - SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK + ] + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK