diff --git a/codemagic.yaml b/codemagic.yaml index 1d540e2..68f92c1 100644 --- a/codemagic.yaml +++ b/codemagic.yaml @@ -15,6 +15,7 @@ workflows: xcode: latest groups: - SLABS + - APPLE_SIGNING vars: BUNDLE_ID: uk.silverlabs.silverapple GITEA_REPO: SilverLABS/SilverApple @@ -26,7 +27,26 @@ workflows: brew install xcodegen xcodegen generate --spec project.yml - - name: Build (unsigned) + - name: Initialize keychain + script: keychain initialize + + - name: Install signing certificate + script: | + echo $CM_CERTIFICATE | base64 --decode > /tmp/cert.p12 + keychain add-certificates \ + --certificate /tmp/cert.p12 \ + --certificate-password $CM_CERTIFICATE_PASSWORD + + - name: Install provisioning profile + script: | + echo $CM_PROVISIONING_PROFILE | base64 --decode > /tmp/profile.mobileprovision + mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles + cp /tmp/profile.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/ + + - name: Configure Xcode signing + script: xcode-project use-profiles + + - name: Build (signed) script: | xcodebuild archive \ -project SilverApple.xcodeproj \ @@ -34,26 +54,28 @@ workflows: -destination "generic/platform=iOS" \ -configuration Release \ -archivePath "$CM_BUILD_DIR/SilverApple.xcarchive" \ - CODE_SIGNING_ALLOWED=NO \ - CODE_SIGNING_REQUIRED=NO \ - CODE_SIGN_IDENTITY="" \ - PROVISIONING_PROFILE="" + DEVELOPMENT_TEAM="$APPLE_TEAM_ID" \ + CODE_SIGN_STYLE=Manual - - name: Package IPA + - name: Export signed IPA script: | - cd "$CM_BUILD_DIR" - APP=$(find SilverApple.xcarchive/Products -name "*.app" -type d | head -1) - if [ -z "$APP" ]; then - echo "ERROR: No .app found in xcarchive. Contents:" - find SilverApple.xcarchive -type d | head -30 - exit 1 - fi - echo "Packaging: $APP" - mkdir -p Payload - cp -r "$APP" Payload/ - zip -r SilverApple.ipa Payload/ - rm -rf Payload - echo "IPA size: $(du -sh SilverApple.ipa | cut -f1)" + cat > /tmp/ExportOptions.plist << 'EOF' + + + + + method + ad-hoc + signingStyle + manual + + + EOF + xcodebuild -exportArchive \ + -archivePath "$CM_BUILD_DIR/SilverApple.xcarchive" \ + -exportPath "$CM_BUILD_DIR/export" \ + -exportOptionsPlist /tmp/ExportOptions.plist + cp "$CM_BUILD_DIR/export/SilverApple.ipa" "$CM_BUILD_DIR/SilverApple.ipa" - name: Publish to Gitea script: | diff --git a/xtool.yml b/xtool.yml index 8398752..66cd053 100644 --- a/xtool.yml +++ b/xtool.yml @@ -1,13 +1,8 @@ # xTool configuration — https://xtool.sh -# Run `xtool configure` once to set up your Apple ID credentials and Darwin SDK. -# Then: `xtool run` to build and install directly to a connected device. +# Run `xtool setup` once to configure your Apple ID credentials and extract the Darwin SDK. +# Then: `xtool dev` to build and deploy directly to a connected USB device. -targets: - SilverApple: - bundleIdentifier: uk.silverlabs.silverapple - # Fill in your Apple Developer Team ID (10-char string from developer.apple.com) - teamID: "" - infoPlist: SilverApple/Info.plist - entitlements: SilverApple/SilverApple.entitlements - deploymentTarget: "16.0" - deviceFamily: [iphone] +version: 1 +bundleID: uk.silverlabs.silverapple +infoPath: SilverApple/Info.plist +entitlementsPath: SilverApple/SilverApple.entitlements