Skip to content

Commit

Permalink
Merge branch 'chore/ci-cd' into 'main':
Browse files Browse the repository at this point in the history
commit a41df3909438d00f917f6160cbc32be352196b25
Author: Lukas Pistrol <lukas@pistrol.com>
Date:   Mon Nov 13 18:10:52 2023 +0100

    add build only workflow

commit 2c2e291
Author: Lukas Pistrol <lukas@pistrol.com>
Date:   Mon Nov 13 18:06:57 2023 +0100

    cleanup

commit 2ef98b8
Author: Lukas Pistrol <lukas@pistrol.com>
Date:   Mon Nov 13 17:50:21 2023 +0100

    install mac signing cert

commit 99bdb6a
Author: Lukas Pistrol <lukas@pistrol.com>
Date:   Mon Nov 13 17:41:08 2023 +0100

    disable xcpretty

commit 324b955
Author: Lukas Pistrol <lukas@pistrol.com>
Date:   Mon Nov 13 17:40:53 2023 +0100

    disable xcpretty

commit 78a952e
Author: Lukas Pistrol <lukas@pistrol.com>
Date:   Mon Nov 13 17:35:10 2023 +0100

    use RUNNER_TEMP as build directory

commit bfceeb9
Author: Lukas Pistrol <lukas@pistrol.com>
Date:   Mon Nov 13 17:29:29 2023 +0100

    test

commit c23a764
Author: Lukas Pistrol <lukas@pistrol.com>
Date:   Mon Nov 13 17:09:57 2023 +0100

    use xcode 15

commit 1e096a7
Author: Lukas Pistrol <lukas@pistrol.com>
Date:   Mon Nov 13 17:07:41 2023 +0100

    add trigger

commit e2585d5
Author: Lukas Pistrol <lukas@pistrol.com>
Date:   Mon Nov 13 16:58:59 2023 +0100

    initial implementation of codesigning and notarization

whatever

add cleanup phase
  • Loading branch information
lukepistrol committed Nov 13, 2023
1 parent 7c267b9 commit 5d45df1
Show file tree
Hide file tree
Showing 6 changed files with 168 additions and 37 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build (PR)

on:
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main

env:
DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer

jobs:
build:
name: Build and Publish Release
runs-on: macOS-13
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install certificates
env:
MAC_SIGN_CERT: ${{ secrets.MAC_SIGN_CERT }}
MAC_SIGN_PW: ${{ secrets.MAC_SIGN_PW }}
KEYCHAIN_TIMEOUT: 21600
run: |
MAC_CERT_P12="$RUNNER_TEMP/mac_cert.p12"
KEYCHAIN_DB="$RUNNER_TEMP/keychain.keychain-db"
KEYCHAIN_PW=$(openssl rand -base64 24)
security create-keychain -p "$KEYCHAIN_PW" "$KEYCHAIN_DB"
security set-keychain-settings -lut "$KEYCHAIN_TIMEOUT" "$KEYCHAIN_DB"
security unlock-keychain -p "$KEYCHAIN_PW" "$KEYCHAIN_DB"
echo -n "$MAC_SIGN_CERT" | base64 --decode -o "$MAC_CERT_P12"
security import "$MAC_CERT_P12" -P "$MAC_SIGN_PW" -A -t cert -f pkcs12 -k "$KEYCHAIN_DB"
security list-keychain -d user -s "$KEYCHAIN_DB"
- name: Build
env:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
set -o pipefail && xcodebuild build -project "TimeMachineStatus.xcodeproj" \
-scheme "TimeMachineStatus" \
-configuration "Release" \
-derivedDataPath "$RUNNER_TEMP/DerivedData" \
DEVELOPMENT_TEAM=$APPLE_TEAM_ID
- name: Clean up keychain and provisioning profile
if: ${{ always() }}
run: |
security delete-keychain "$RUNNER_TEMP/keychain.keychain-db"
rm -rf "~/Library/MobileDevice/Provisioning Profiles"
95 changes: 95 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Build & Publish

on:
workflow_dispatch:

env:
DEVELOPER_DIR: /Applications/Xcode_15.0.app/Contents/Developer

jobs:
build:
name: Build and Publish Release
runs-on: macOS-13
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Tooling
run: |
brew install create-dmg
- name: Install certificates
env:
DEV_SIGN_CERT: ${{ secrets.DEV_SIGN_CERT }}
DEV_SIGN_PW: ${{ secrets.DEV_SIGN_PW }}
MAC_SIGN_CERT: ${{ secrets.MAC_SIGN_CERT }}
MAC_SIGN_PW: ${{ secrets.MAC_SIGN_PW }}
KEYCHAIN_TIMEOUT: 21600
run: |
DEV_CERT_P12="$RUNNER_TEMP/dev_cert.p12"
MAC_CERT_P12="$RUNNER_TEMP/mac_cert.p12"
KEYCHAIN_DB="$RUNNER_TEMP/keychain.keychain-db"
KEYCHAIN_PW=$(openssl rand -base64 24)
security create-keychain -p "$KEYCHAIN_PW" "$KEYCHAIN_DB"
security set-keychain-settings -lut "$KEYCHAIN_TIMEOUT" "$KEYCHAIN_DB"
security unlock-keychain -p "$KEYCHAIN_PW" "$KEYCHAIN_DB"
echo -n "$DEV_SIGN_CERT" | base64 --decode -o "$DEV_CERT_P12"
security import "$DEV_CERT_P12" -P "$DEV_SIGN_PW" -A -t cert -f pkcs12 -k "$KEYCHAIN_DB"
echo -n "$MAC_SIGN_CERT" | base64 --decode -o "$MAC_CERT_P12"
security import "$MAC_CERT_P12" -P "$MAC_SIGN_PW" -A -t cert -f pkcs12 -k "$KEYCHAIN_DB"
security list-keychain -d user -s "$KEYCHAIN_DB"
- name: Build
env:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
set -o pipefail && xcodebuild archive -project "TimeMachineStatus.xcodeproj" \
-scheme "TimeMachineStatus" \
-configuration "Release" \
-derivedDataPath "$RUNNER_TEMP/DerivedData" \
-archivePath "$RUNNER_TEMP/TimeMachineStatus.xcarchive" \
DEVELOPMENT_TEAM=$APPLE_TEAM_ID
- name: Sign
env:
CODE_SIGN_IDENTITY: ${{ secrets.CODE_SIGN_IDENTITY }}
run: |
codesign \
--sign "$CODE_SIGN_IDENTITY" \
-vvv --verbose --strict \
--options=runtime \
--prefix com.lukaspistrol.TimeMachineStatus \
--force --deep --timestamp \
"$RUNNER_TEMP/TimeMachineStatus.xcarchive/Products/Applications/TimeMachineStatus.app"
- name: Create DMG
env:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
run: |
xcrun notarytool store-credentials TimeMachineStatus \
--apple-id "$APPLE_ID" \
--team-id "$APPLE_TEAM_ID" \
--password "$APPLE_ID_PASSWORD"
create-dmg \
--volname "TimeMachineStatus" \
--volicon "$RUNNER_TEMP/TimeMachineStatus.xcarchive/Products/Applications/TimeMachineStatus.app/Contents/Resources/AppIcon.icns" \
--window-pos 200 120 \
--window-size 800 400 \
--icon-size 100 \
--icon "TimeMachineStatus.app" 200 190 \
--hide-extension "TimeMachineStatus.app" \
--app-drop-link 600 185 \
--notarize "TimeMachineStatus" \
--skip-jenkins \
"$RUNNER_TEMP/TimeMachineStatus.dmg" \
"$RUNNER_TEMP/TimeMachineStatus.xcarchive/Products/Applications/TimeMachineStatus.app"
- name: Clean up keychain and provisioning profile
if: ${{ always() }}
run: |
security delete-keychain "$RUNNER_TEMP/keychain.keychain-db"
rm -rf "~/Library/MobileDevice/Provisioning Profiles"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,5 @@ fastlane/test_output
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/

.env
17 changes: 0 additions & 17 deletions TimeMachineStatus.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
28A0021D2AFBBFC300E2A01E /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28A0021C2AFBBFC300E2A01E /* SettingsView.swift */; };
28A0021F2AFBBFC400E2A01E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 28A0021E2AFBBFC400E2A01E /* Assets.xcassets */; };
28A002222AFBBFC400E2A01E /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 28A002212AFBBFC400E2A01E /* Preview Assets.xcassets */; };
28A002472AFBC09000E2A01E /* SFSymbolsMacro in Frameworks */ = {isa = PBXBuildFile; productRef = 28A002462AFBC09000E2A01E /* SFSymbolsMacro */; };
28A0024A2AFBC91500E2A01E /* ShellOut in Frameworks */ = {isa = PBXBuildFile; productRef = 28A002492AFBC91500E2A01E /* ShellOut */; };
28A0024D2AFC02DA00E2A01E /* Bool+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28A0024C2AFC02DA00E2A01E /* Bool+.swift */; };
28A0024F2AFC030500E2A01E /* Symbols.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28A0024E2AFC030500E2A01E /* Symbols.swift */; };
Expand Down Expand Up @@ -138,7 +137,6 @@
281822622AFD40920067E564 /* Logging in Frameworks */,
28A0024A2AFBC91500E2A01E /* ShellOut in Frameworks */,
28263FA32B023FFE00F74655 /* ServiceManagement.framework in Frameworks */,
28A002472AFBC09000E2A01E /* SFSymbolsMacro in Frameworks */,
281822652AFD438B0067E564 /* LoggingOSLog in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -356,7 +354,6 @@
);
name = TimeMachineStatus;
packageProductDependencies = (
28A002462AFBC09000E2A01E /* SFSymbolsMacro */,
28A002492AFBC91500E2A01E /* ShellOut */,
281822612AFD40920067E564 /* Logging */,
281822642AFD438B0067E564 /* LoggingOSLog */,
Expand Down Expand Up @@ -395,7 +392,6 @@
);
mainGroup = 28A0020E2AFBBFC300E2A01E;
packageReferences = (
28A002452AFBC09000E2A01E /* XCRemoteSwiftPackageReference "SFSymbolsMacro" */,
28A002482AFBC91500E2A01E /* XCRemoteSwiftPackageReference "ShellOut" */,
281822602AFD40920067E564 /* XCRemoteSwiftPackageReference "swift-log" */,
281822632AFD438B0067E564 /* XCRemoteSwiftPackageReference "swift-log-oslog" */,
Expand Down Expand Up @@ -771,14 +767,6 @@
minimumVersion = 0.2.2;
};
};
28A002452AFBC09000E2A01E /* XCRemoteSwiftPackageReference "SFSymbolsMacro" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/lukepistrol/SFSymbolsMacro.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.5.0;
};
};
28A002482AFBC91500E2A01E /* XCRemoteSwiftPackageReference "ShellOut" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/JohnSundell/ShellOut.git";
Expand All @@ -800,11 +788,6 @@
package = 281822632AFD438B0067E564 /* XCRemoteSwiftPackageReference "swift-log-oslog" */;
productName = LoggingOSLog;
};
28A002462AFBC09000E2A01E /* SFSymbolsMacro */ = {
isa = XCSwiftPackageProductDependency;
package = 28A002452AFBC09000E2A01E /* XCRemoteSwiftPackageReference "SFSymbolsMacro" */;
productName = SFSymbolsMacro;
};
28A002492AFBC91500E2A01E /* ShellOut */ = {
isa = XCSwiftPackageProductDependency;
package = 28A002482AFBC91500E2A01E /* XCRemoteSwiftPackageReference "ShellOut" */;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
{
"pins" : [
{
"identity" : "sfsymbolsmacro",
"kind" : "remoteSourceControl",
"location" : "https://github.com/lukepistrol/SFSymbolsMacro.git",
"state" : {
"revision" : "ad2183d29dc928f7f9cd5dc6efcc4546efc7857b",
"version" : "0.5.1"
}
},
{
"identity" : "shellout",
"kind" : "remoteSourceControl",
Expand All @@ -35,15 +26,6 @@
"revision" : "176d41d46429e79c806333025b226e0c50a0c602",
"version" : "0.2.2"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax.git",
"state" : {
"revision" : "6ad4ea24b01559dde0773e3d091f1b9e36175036",
"version" : "509.0.2"
}
}
],
"version" : 2
Expand Down
18 changes: 16 additions & 2 deletions TimeMachineStatus/Symbols.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
//

import SwiftUI
import SFSymbolsMacro

@SFSymbol
enum Symbols: String {
case checkmarkCircleFill = "checkmark.circle.fill"
case exclamationMarkTriangleFill = "exclamationmark.triangle.fill"
Expand All @@ -26,4 +24,20 @@ enum Symbols: String {
case timeMachine = "clock.arrow.circlepath"
case wandAndStarsInverse = "wand.and.stars.inverse"
case xmarkCircleFill = "xmark.circle.fill"

var image: Image {
Image(systemName: self.rawValue)
}

var name: String {
self.rawValue
}

func nsImage(accessibilityDescription: String? = nil) -> NSImage {
return NSImage(systemSymbolName: self.rawValue, accessibilityDescription: accessibilityDescription)!
}

func callAsFunction() -> String {
return self.rawValue
}
}

0 comments on commit 5d45df1

Please sign in to comment.