-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
161 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: ['main'] | ||
pull_request: | ||
branches: ['main'] | ||
|
||
jobs: | ||
build: | ||
name: Build and analyze using xcodebuild | ||
runs-on: macos-14 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Select Xcode version 15 | ||
uses: maxim-lobanov/setup-xcode@v1 | ||
with: | ||
xcode-version: '15' | ||
- name: Build | ||
run: | | ||
xcodebuild clean build analyze -project 'Nautik Helper.xcodeproj' -scheme 'Nautik Helper' | xcpretty && exit ${PIPESTATUS[0]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: Release | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build: | ||
name: Build app bundle and upload it to the release | ||
runs-on: macos-14 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Select Xcode version 15 | ||
uses: maxim-lobanov/setup-xcode@v1 | ||
with: | ||
xcode-version: '15' | ||
# https://docs.github.com/en/actions/deployment/deploying-xcode-applications/installing-an-apple-certificate-on-macos-runners-for-xcode-development#creating-secrets-for-your-certificate-and-provisioning-profile | ||
# https://defn.io/2023/09/22/distributing-mac-apps-with-github-actions | ||
- name: Install the Apple certificate and provisioning profile | ||
env: | ||
# exported from Xcode (Developer ID Application Certificate) | ||
# base64 -i ID_CERTIFICATE.p12 > ID_CERTIFICATE_BASE64 | ||
ID_CERTIFICATE_BASE64: ${{ secrets.ID_CERTIFICATE_BASE64 }} | ||
# openssl rand -hex 32 > ID_CERTIFICATE_PASSWORD | ||
ID_CERTIFICATE_PASSWORD: ${{ secrets.ID_CERTIFICATE_PASSWORD }} | ||
# exported from Xcode (Apple Development Certificate) | ||
# base64 -i BUILD_CERTIFICATE.p12 > BUILD_CERTIFICATE_BASE64 | ||
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} | ||
# openssl rand -hex 32 > BUILD_CERTIFICATE_PASSWORD | ||
BUILD_CERTIFICATE_PASSWORD: ${{ secrets.BUILD_CERTIFICATE_PASSWORD }} | ||
# openssl rand -hex 32 > KEYCHAIN_PASSWORD | ||
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} | ||
run: | | ||
# create variables | ||
ID_CERTIFICATE_PATH=$RUNNER_TEMP/id_certificate.p12 | ||
BUILD_CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 | ||
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db | ||
# import certificates from secrets | ||
echo -n "$ID_CERTIFICATE_BASE64" | base64 --decode -o $ID_CERTIFICATE_PATH | ||
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $BUILD_CERTIFICATE_PATH | ||
# create temporary keychain | ||
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | ||
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH | ||
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | ||
# import certificate to keychain | ||
security import $ID_CERTIFICATE_PATH -P "$ID_CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH | ||
security import $BUILD_CERTIFICATE_PATH -P "$BUILD_CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH | ||
security list-keychain -d user -s $KEYCHAIN_PATH | ||
- name: Build app | ||
run: | | ||
mkdir -p dist | ||
xcodebuild \ | ||
archive \ | ||
-project 'Nautik Helper.xcodeproj'/ \ | ||
-scheme 'Nautik Helper' \ | ||
-configuration Release \ | ||
-destination 'generic/platform=macOS' \ | ||
-archivePath 'dist/Nautik Helper.xcarchive' \ | ||
-allowProvisioningUpdates | ||
xcodebuild \ | ||
-exportArchive \ | ||
-archivePath 'dist/Nautik Helper.xcarchive' \ | ||
-exportOptionsPlist 'Nautik Helper/ExportOptions.plist' \ | ||
-exportPath dist/ \ | ||
-allowProvisioningUpdates | ||
ditto -c -k --keepParent 'dist/Nautik Helper.app' dist/helper-${{ github.ref }}.zip | ||
xcrun notarytool submit \ | ||
--wait \ | ||
--key /Users/elias/Downloads/AuthKey_6F3C73566R.p8 \ | ||
--key-id 6F3C73566R \ | ||
--issuer bc562387-e432-4ba9-90bc-bae79d1a299e \ | ||
dist/helper-1.0.0.zip | ||
xcrun stapler staple 'dist/Nautik Helper.app' | ||
# https://stackoverflow.com/questions/60608887/what-is-the-most-efficient-way-to-notarize-and-staple-a-zip-containing-a-app | ||
rm dist/helper-1.0.0.zip | ||
ditto -c -k --keepParent 'dist/Nautik Helper.app' dist/helper-${{ github.ref }}.zip | ||
- name: Upload app bundle to release | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
file: dist/helper-${{ github.ref }}.zip | ||
asset_name: helper-${{ github.ref }}.zip | ||
tag: ${{ github.ref }} | ||
overwrite: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters