diff --git a/.github/workflows/build-analyze.yml b/.github/workflows/build-analyze.yml index c564800..717a531 100644 --- a/.github/workflows/build-analyze.yml +++ b/.github/workflows/build-analyze.yml @@ -8,7 +8,7 @@ on: jobs: build: - name: Build and analyse using xcodebuild command + name: Build and Analyse Using xcodebuild Command runs-on: macos-13 steps: @@ -20,6 +20,6 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Build + - name: Build and Analyse Reveil run: | xcodebuild clean build analyze -scheme Reveil -project Reveil.xcodeproj CODE_SIGNING_ALLOWED=NO | xcpretty && exit ${PIPESTATUS[0]} diff --git a/.github/workflows/build-archive-macos.yml b/.github/workflows/build-archive-macos.yml new file mode 100644 index 0000000..c320cfb --- /dev/null +++ b/.github/workflows/build-archive-macos.yml @@ -0,0 +1,97 @@ +name: Xcode - Build Archive (macOS) + +on: + push: + branches: [ "feat/macos-native-support" ] + +env: + MARKETING_VERSION: 0.0.0 + PATCH_VERSION: 0 + DEVELOPMENT_TEAM: GXZ23M5TP2 + PACKAGING_IDENTITY: 'Developer ID Application: Zheng Wu (GXZ23M5TP2)' + +jobs: + build: + name: Build Notarized macOS Application + runs-on: macos-13 + + steps: + - name: Configure Code-Signing Keychain + run: | + KETSTORE_PATH="$PWD/Certificates/Certificates.p12" + KEYCHAIN_PATH="$RUNNER_TEMP/app-signing.keychain-db" + security create-keychain -p "$KEYSTORE_PASSWORD" "$KEYCHAIN_PATH" + security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH" + security unlock-keychain -p "$KEYSTORE_PASSWORD" "$KEYCHAIN_PATH" + security import "$KETSTORE_PATH" -P "$KEYSTORE_PASSWORD" -A -t cert -f pkcs12 -k "$KEYCHAIN_PATH" + security list-keychain -d user -s "$KEYCHAIN_PATH" + env: + KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} + + - name: Setup Xcode Version + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: 15.1 + + - name: Checkout + uses: actions/checkout@v3 + + - name: Update Version Strings + run: | + export PATCH_VERSION=$(echo "${GITHUB_REF#refs/tags/v}" | cut -d. -f3) + echo "PATCH_VERSION=${PATCH_VERSION}" >> $GITHUB_ENV + echo "MARKETING_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV + xcrun agvtool new-version -all "${PATCH_VERSION}" + xcrun agvtool new-marketing-version "${GITHUB_REF#refs/tags/v}" + + - name: Build ReveilHelper + run: | + xcodebuild clean build archive -scheme ReveilHelper -project Reveil.xcodeproj -archivePath ReveilHelper.xcarchive CODE_SIGNING_ALLOWED=NO | xcpretty && exit ${PIPESTATUS[0]} + + - name: Build Reveil (macOS) + run: | + PATH=$PWD/ReveilHelper.xcarchive/Products/usr/local/bin:$PATH xcodebuild clean build archive -scheme Reveil -project Reveil.xcodeproj -sdk macosx -destination 'generic/platform=macOS' -archivePath Reveil CODE_SIGN_STYLE='Automatic' CODE_SIGN_IDENTITY='Apple Development' DEVELOPMENT_TEAM='${{ env.DEVELOPMENT_TEAM }}' | xcpretty && exit ${PIPESTATUS[0]} + + - name: Notarize Reveil + run: | + mkdir -p Distribution + xcodebuild -exportArchive -archivePath Reveil.xcarchive -exportPath Distribution -exportOptionsPlist $PWD/ExportOptions.plist + + - name: Export Notarized Application + run: | + until xcodebuild -exportNotarizedApp -archivePath Reveil.xcarchive -exportPath Distribution; + do + echo "Waiting for notarization..." + sleep 10 + done + + - name: Install Packaging Tools + run: | + brew install graphicsmagick imagemagick + npm install -g create-dmg + + - name: Create DMG + run: | + create-dmg --overwrite --identity='${{ env.PACKAGING_IDENTITY }}' Distribution/Reveil.app ./Distribution/ + mv Distribution/*.dmg Reveil_${{ env.MARKETING_VERSION }}.dmg + + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: Reveil_${{ env.MARKETING_VERSION }} + path: | + Reveil.xcarchive + ReveilHelper.xcarchive + Distribution/Reveil_${{ env.MARKETING_VERSION }}.dmg + + - name: Upload Release + uses: softprops/action-gh-release@v1 + with: + token: ${{ secrets.RELEASE_GITHUB_TOKEN }} + body_path: CHANGELOG.md + files: Distribution/Reveil_${{ env.MARKETING_VERSION }}.dmg + + - name: Remove Code-Signing Keychain + if: ${{ always() }} + run: | + security delete-keychain "$RUNNER_TEMP/app-signing.keychain-db" diff --git a/.github/workflows/build-archive.yml b/.github/workflows/build-archive.yml index 600df9b..29920f2 100644 --- a/.github/workflows/build-archive.yml +++ b/.github/workflows/build-archive.yml @@ -11,11 +11,11 @@ env: jobs: build: - name: Build sideloading package for TrollStore + name: Build Side-loading Package for TrollStore runs-on: macos-13 steps: - - name: Setup Xcode version + - name: Setup Xcode Version uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: 15.1 @@ -23,7 +23,7 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Update version strings + - name: Update Version Strings run: | export PATCH_VERSION=$(echo "${GITHUB_REF#refs/tags/v}" | cut -d. -f3) echo "PATCH_VERSION=${PATCH_VERSION}" >> $GITHUB_ENV @@ -31,15 +31,15 @@ jobs: xcrun agvtool new-version -all "${PATCH_VERSION}" xcrun agvtool new-marketing-version "${GITHUB_REF#refs/tags/v}" - - name: Build helper + - name: Build ReveilHelper run: | xcodebuild clean build archive -scheme ReveilHelper -project Reveil.xcodeproj -archivePath ReveilHelper.xcarchive CODE_SIGNING_ALLOWED=NO | xcpretty && exit ${PIPESTATUS[0]} - - name: Build + - name: Build Reveil run: | PATH=$PWD/ReveilHelper.xcarchive/Products/usr/local/bin:$PATH xcodebuild clean build archive -scheme Reveil -project Reveil.xcodeproj -sdk iphoneos -destination 'generic/platform=iOS' -archivePath Reveil CODE_SIGNING_ALLOWED=NO | xcpretty && exit ${PIPESTATUS[0]} - - name: Package for sideloading + - name: Package for Side-loading run: | cd Reveil.xcarchive/Products/Applications codesign --remove-signature Reveil.app @@ -48,17 +48,22 @@ jobs: mv Applications Payload zip -qr Reveil_${{ env.MARKETING_VERSION }}.tipa Payload cd - - mv Reveil.xcarchive/Products/Reveil_${{ env.MARKETING_VERSION }}.tipa . + mkdir -p Distribution + mv Reveil.xcarchive/Products/Reveil_${{ env.MARKETING_VERSION }}.tipa ./Distribution/ - - name: Upload artifact + - name: Upload Artifact uses: actions/upload-artifact@v3 with: name: Reveil_${{ env.MARKETING_VERSION }} - path: Reveil.xcarchive + path: | + Reveil.xcarchive + ReveilHelper.xcarchive + Distribution/Reveil_${{ env.MARKETING_VERSION }}.tipa - - name: Upload release + - name: Upload Release uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') with: token: ${{ secrets.RELEASE_GITHUB_TOKEN }} body_path: CHANGELOG.md - files: Reveil_${{ env.MARKETING_VERSION }}.tipa + files: Distribution/Reveil_${{ env.MARKETING_VERSION }}.tipa diff --git a/.gitignore b/.gitignore index 25b543a..883cd50 100644 --- a/.gitignore +++ b/.gitignore @@ -67,6 +67,7 @@ DerivedData/ *.dSYM.zip *.dSYM *.xcarchive +Distribution ## Playgrounds timeline.xctimeline diff --git a/Certificates/Certificates.p12 b/Certificates/Certificates.p12 index a19c57b..2fe9711 100644 Binary files a/Certificates/Certificates.p12 and b/Certificates/Certificates.p12 differ diff --git a/ExportOptions.plist b/ExportOptions.plist new file mode 100644 index 0000000..12ae833 --- /dev/null +++ b/ExportOptions.plist @@ -0,0 +1,14 @@ + + + + + destination + upload + method + developer-id + signingStyle + automatic + teamID + GXZ23M5TP2 + + diff --git a/Reveil.xcodeproj/project.pbxproj b/Reveil.xcodeproj/project.pbxproj index 737b439..4b1e112 100644 --- a/Reveil.xcodeproj/project.pbxproj +++ b/Reveil.xcodeproj/project.pbxproj @@ -1138,6 +1138,7 @@ LOCALIZATION_PREFERS_STRING_CATALOGS = YES; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; + SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; SWIFT_VERSION = 5.0; }; @@ -1156,6 +1157,7 @@ LOCALIZATION_PREFERS_STRING_CATALOGS = YES; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; + SKIP_INSTALL = YES; SWIFT_VERSION = 5.0; }; name = Release; diff --git a/Reveil/Assets.xcassets/AppIcon.appiconset/Contents.json b/Reveil/Assets.xcassets/AppIcon.appiconset/Contents.json index d7ab46b..6ce35ce 100644 --- a/Reveil/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/Reveil/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -5,6 +5,66 @@ "idiom" : "universal", "platform" : "ios", "size" : "1024x1024" + }, + { + "filename" : "icon_16x16.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "filename" : "icon_16x16@2x.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "filename" : "icon_32x32.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "filename" : "icon_32x32@2x.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "filename" : "icon_128x128.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "filename" : "icon_128x128@2x.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "filename" : "icon_256x256.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "filename" : "icon_256x256@2x.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "filename" : "icon_512x512.png", + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "filename" : "icon_512x512@2x.png", + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" } ], "info" : { diff --git a/Reveil/Assets.xcassets/AppIcon.appiconset/icon_128x128.png b/Reveil/Assets.xcassets/AppIcon.appiconset/icon_128x128.png new file mode 100644 index 0000000..b5d7f8d Binary files /dev/null and b/Reveil/Assets.xcassets/AppIcon.appiconset/icon_128x128.png differ diff --git a/Reveil/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png b/Reveil/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png new file mode 100644 index 0000000..31a2c48 Binary files /dev/null and b/Reveil/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png differ diff --git a/Reveil/Assets.xcassets/AppIcon.appiconset/icon_16x16.png b/Reveil/Assets.xcassets/AppIcon.appiconset/icon_16x16.png new file mode 100644 index 0000000..6a500f7 Binary files /dev/null and b/Reveil/Assets.xcassets/AppIcon.appiconset/icon_16x16.png differ diff --git a/Reveil/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png b/Reveil/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png new file mode 100644 index 0000000..c4ad0a2 Binary files /dev/null and b/Reveil/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png differ diff --git a/Reveil/Assets.xcassets/AppIcon.appiconset/icon_256x256.png b/Reveil/Assets.xcassets/AppIcon.appiconset/icon_256x256.png new file mode 100644 index 0000000..31a2c48 Binary files /dev/null and b/Reveil/Assets.xcassets/AppIcon.appiconset/icon_256x256.png differ diff --git a/Reveil/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png b/Reveil/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png new file mode 100644 index 0000000..0920a70 Binary files /dev/null and b/Reveil/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png differ diff --git a/Reveil/Assets.xcassets/AppIcon.appiconset/icon_32x32.png b/Reveil/Assets.xcassets/AppIcon.appiconset/icon_32x32.png new file mode 100644 index 0000000..c4ad0a2 Binary files /dev/null and b/Reveil/Assets.xcassets/AppIcon.appiconset/icon_32x32.png differ diff --git a/Reveil/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png b/Reveil/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png new file mode 100644 index 0000000..6ea325c Binary files /dev/null and b/Reveil/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png differ diff --git a/Reveil/Assets.xcassets/AppIcon.appiconset/icon_512x512.png b/Reveil/Assets.xcassets/AppIcon.appiconset/icon_512x512.png new file mode 100644 index 0000000..0920a70 Binary files /dev/null and b/Reveil/Assets.xcassets/AppIcon.appiconset/icon_512x512.png differ diff --git a/Reveil/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png b/Reveil/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png new file mode 100644 index 0000000..49aaaaf Binary files /dev/null and b/Reveil/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png differ diff --git a/Reveil/DataModels/Presets/SecurityPresets.swift b/Reveil/DataModels/Presets/SecurityPresets.swift index 68317b2..ad95682 100644 --- a/Reveil/DataModels/Presets/SecurityPresets.swift +++ b/Reveil/DataModels/Presets/SecurityPresets.swift @@ -36,21 +36,24 @@ struct SecurityPresets: Codable { private init() {} init(bundleURL: URL) throws { - guard bundleURL.appendingPathComponent("Info.plist").fileExists || - bundleURL.appendingPathComponent("Contents/Info.plist").fileExists, - let bundle = Bundle(url: bundleURL) + let isMobileBundle = bundleURL.appendingPathComponent("Info.plist").fileExists + let isDesktopBundle = bundleURL.appendingPathComponent("Contents/Info.plist").fileExists + + guard isMobileBundle || isDesktopBundle, let bundle = Bundle(url: bundleURL) else { throw ConstructError.invalidBundle(message: String(format: "Failed to initialize bundle at: %@", bundleURL.path)) } - if let bundleExecutableURL = bundle.executableURL, + if isMobileBundle, + let bundleExecutableURL = bundle.executableURL, let executableHashValue = IntegrityChecker.getMachOFileHashValue(.customExecutable(bundleExecutableURL)) { secureMainExecutableMachOHashes.removeAll(keepingCapacity: true) secureMainExecutableMachOHashes.insert(executableHashValue) } - if let bundleProvisioningProfilePath = bundle.path(forResource: "embedded", ofType: "mobileprovision"), + if isMobileBundle, + let bundleProvisioningProfilePath = bundle.path(forResource: "embedded", ofType: "mobileprovision"), let profileHashValue = IntegrityChecker.calculateHashValue(path: bundleProvisioningProfilePath) { secureMobileProvisioningProfileHashes.removeAll(keepingCapacity: true)