diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d4347ce..05d77cb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,9 +30,9 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Set Xcode 13.4 + - name: Set Xcode 14.3.1 run: | - sudo xcode-select -switch /Applications/Xcode_13.4.app + sudo xcode-select -switch /Applications/Xcode_14.3.1.app - name: iOS Build run: | @@ -87,6 +87,12 @@ jobs: - name: Validate Podfile run: pod lib lint --allow-warnings + - name: Build xcframework + run: scripts/build_framework.sh + + - name: Zip xcframework + run: zip -r .build/artifacts/AnalyticsConnector.xcframework.zip .build/artifacts/AnalyticsConnector.xcframework + - name: Semantic Release --dry-run if: ${{ github.event.inputs.dryRun == 'true'}} env: diff --git a/.github/workflows/semantic-pr.yml b/.github/workflows/semantic-pr.yml index ab3c09a..bd58e60 100644 --- a/.github/workflows/semantic-pr.yml +++ b/.github/workflows/semantic-pr.yml @@ -6,7 +6,7 @@ on: jobs: pr-title-check: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - name: PR title is valid if: > diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 30af278..3287051 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,9 +13,9 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Set Xcode 13.4 + - name: Set Xcode 14.3.1 run: | - sudo xcode-select -switch /Applications/Xcode_13.4.app + sudo xcode-select -switch /Applications/Xcode_14.3.1.app - name: iOS Build run: | diff --git a/release.config.js b/release.config.js index bf4f61b..f3945d4 100644 --- a/release.config.js +++ b/release.config.js @@ -13,7 +13,12 @@ module.exports = { ["@semantic-release/changelog", { "changelogFile": "CHANGELOG.md" }], - "@semantic-release/github", + [ + "@semantic-release/github", { + "assets": [ + { "path": ".build/artifacts/AnalyticsConnector.xcframework.zip" }, + ] + }], [ "@google/semantic-release-replace-plugin", { diff --git a/scripts/build_framework.sh b/scripts/build_framework.sh new file mode 100755 index 0000000..10b3520 --- /dev/null +++ b/scripts/build_framework.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +set -e + +SCHEME="AnalyticsConnector" +FRAMEWORK="AnalyticsConnector" +BUILD_DIR="./.build/artifacts" +OUTPUT_PATH="$BUILD_DIR/$FRAMEWORK.xcframework" +PLATFORMS=("macOS" "iOS" "iOS Simulator" "tvOS" "tvOS Simulator" "watchOS" "watchOS Simulator") + +build_framework_with_configuration_and_name() { + CONFIGURATION=${1} + # Create a framework for each supported sdk + declare -a ARCHIVES + for PLATFORM in "${PLATFORMS[@]}" + do + ARCHIVE="$BUILD_DIR/$CONFIGURATION/$FRAMEWORK-$PLATFORM.xcarchive" + xcodebuild archive \ + -scheme "$SCHEME" \ + -configuration "$CONFIGURATION" \ + -archivePath "$ARCHIVE" \ + -destination "generic/platform=$PLATFORM" \ + SKIP_INSTALL=NO \ + BUILD_LIBRARY_FOR_DISTRIBUTION=YES + ARCHIVES+=("$ARCHIVE") + done + + # then bundle them into an xcframework + CREATE_XCFRAMEWORK="xcodebuild -create-xcframework -output '$OUTPUT_PATH'" + for ARCHIVE in "${ARCHIVES[@]}" + do + CREATE_XCFRAMEWORK="$CREATE_XCFRAMEWORK -archive '$ARCHIVE' -framework '$FRAMEWORK.framework'" + done + eval "$CREATE_XCFRAMEWORK" + + # Fixup - Resolve module/class name conflicts + for SWIFT_INTERFACE in $(find "$OUTPUT_PATH" -name "*.private.swiftinterface") + do + sed -i "" "s/AnalyticsConnector\.//" "$SWIFT_INTERFACE" + done +} + +rm -rf "$BUILD_DIR" +mkdir -p "$BUILD_DIR" +build_framework_with_configuration_and_name "Release" "AnalyticsConnector"