Skip to content

Fix/fix podspec

Fix/fix podspec #21

name: "Create XCFramework and Deploy Swift-PM"
on:
pull_request:
branches:
- master
jobs:
build:
runs-on: macos-14-xlarge
permissions:
contents: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Configure Git
run: |
git config user.email "[email protected]"
git config user.name "github actions"
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ap-northeast-1
role-to-assume: arn:aws:iam::161473449094:role/ProductionNativeSdkRole
role-session-name: MySessionName
- name: Select Xcode version
run: sudo xcode-select -s '/Applications/Xcode_15.4.app'
- name: Get Release Version
id: release-version
run: |
gem install fastlane
version=`fastlane run version_get_podspec | grep -o -E "([0-9]+\.){1}[0-9]+(\.[0-9]+)?" | head -n1`
echo "VERSION=${version}" >> "$GITHUB_OUTPUT"
- name: Check if it has already been released
env:
VERSION: ${{ steps.release-version.outputs.VERSION }}
run: |
git fetch
if [ `git tag | grep "${VERSION}-patch"` ]; then
echo "Please bump up version number!!"
exit 1
fi
- name: Create XCFramework
run: xcodebuild -configuration Release -target 'CrashReporter'
- name: Checkout Head Branch
uses: actions/checkout@v2
with:
ref: ${{github.event.pull_request.head.ref}}
clean: 'false'
- name: Replace XCFramework
run: |
rm -rf CrashReporter.xcframework
rm -rf KarteCrashReporter.xcframework
cp -pR build/Release/CrashReporter.xcframework ./
# Copy and rename framework to avoid conflict with older framework path for uploading to S3
cp -r CrashReporter.xcframework KarteCrashReporter.xcframework
zip -r KarteCrashReporter.xcframework.zip KarteCrashReporter.xcframework
- name: Upload XCFramework to aws s3
env:
VERSION: ${{ steps.release-version.outputs.VERSION }}
run: |
aws sts get-caller-identity
aws s3 ls s3://production-native-sdk/
aws s3 cp ./KarteCrashReporter.xcframework.zip s3://production-native-sdk/ios/swiftpm/KarteCrashReporter-${VERSION}/ --acl public-read
- name: Replace Package.swift
env:
VERSION: ${{ steps.release-version.outputs.VERSION }}
run: |
rm Package.swift
cp .KarteTemplate-Package.swift Package.swift
url="https:\/\/sdk.karte.io\/ios\/swiftpm\/KarteCrashReporter-${VERSION}\/KarteCrashReporter.xcframework.zip"
checksum=$(swift package compute-checksum ./KarteCrashReporter.xcframework.zip)
sed -i "" "s/<__URL__>/url: \"${url}\"/g" "./Package.swift"
sed -i "" "s/<__CHECKSUM__>/checksum: \"${checksum}\"/g" "./Package.swift"
- name: Update Swift-PM manifest file
run: |
git add Package.swift
git add CrashReporter.xcframework
git add KarteCrashReporter.xcframework
git commit -m "[skip ci] Update xcframework"
git push