Skip to content

Commit

Permalink
ci: add macOS version
Browse files Browse the repository at this point in the history
Signed-off-by: 82Flex <[email protected]>
  • Loading branch information
Lessica committed Jan 16, 2024
1 parent e7bfc1a commit 0609dd5
Show file tree
Hide file tree
Showing 19 changed files with 200 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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]}
97 changes: 97 additions & 0 deletions .github/workflows/build-archive-macos.yml
Original file line number Diff line number Diff line change
@@ -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: Checkout
uses: actions/checkout@v3

- 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: 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"
27 changes: 16 additions & 11 deletions .github/workflows/build-archive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,35 @@ 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

- 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
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 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
Expand All @@ -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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ DerivedData/
*.dSYM.zip
*.dSYM
*.xcarchive
Distribution

## Playgrounds
timeline.xctimeline
Expand Down
Binary file modified Certificates/Certificates.p12
Binary file not shown.
14 changes: 14 additions & 0 deletions ExportOptions.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>destination</key>
<string>upload</string>
<key>method</key>
<string>developer-id</string>
<key>signingStyle</key>
<string>automatic</string>
<key>teamID</key>
<string>GXZ23M5TP2</string>
</dict>
</plist>
2 changes: 2 additions & 0 deletions Reveil.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand All @@ -1156,6 +1157,7 @@
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
};
name = Release;
Expand Down
60 changes: 60 additions & 0 deletions Reveil/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,66 @@
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"filename" : "icon_16x16.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"filename" : "[email protected]",
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"filename" : "icon_32x32.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"filename" : "[email protected]",
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"filename" : "icon_128x128.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"filename" : "[email protected]",
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"filename" : "icon_256x256.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"filename" : "[email protected]",
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"filename" : "icon_512x512.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"filename" : "[email protected]",
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
}
],
"info" : {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 8 additions & 5 deletions Reveil/DataModels/Presets/SecurityPresets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0609dd5

Please sign in to comment.