-
Notifications
You must be signed in to change notification settings - Fork 238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sign MacOS Binaries with JFrog Certificate #2563
Open
EyalDelarea
wants to merge
197
commits into
jfrog:dev
Choose a base branch
from
EyalDelarea:sign_apple_binary
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
197 commits
Select commit
Hold shift + click to select a range
c55e8a6
Test sign
EyalDelarea 75b2099
Test sign
EyalDelarea 47d17ec
Test
EyalDelarea 719a144
permissons
EyalDelarea 0f2a042
Test
EyalDelarea d69ea64
Test
EyalDelarea 18cf657
Test
EyalDelarea a14f1b7
Test
EyalDelarea bd27d32
Test
EyalDelarea 63c076f
Test
EyalDelarea 780fba2
Test
EyalDelarea bdd0b11
Test
EyalDelarea 69c3d24
Test
EyalDelarea a07db27
Test
EyalDelarea 0d1d6fb
Test
EyalDelarea 450eead
Test
EyalDelarea 5913396
Test
EyalDelarea 677133f
Test
EyalDelarea 161e1d6
Test
EyalDelarea 10952e8
Add comments
EyalDelarea cc97c00
TEST
EyalDelarea ca25bef
TEST
EyalDelarea b6415a3
Update script
EyalDelarea 0a9a365
Merge branch 'dev' of https://github.com/jfrog/jfrog-cli into sign_ap…
EyalDelarea 4d3e17d
Update script path
EyalDelarea cc5d979
Update
EyalDelarea 7a41d74
Update
EyalDelarea 6c0d359
Update
EyalDelarea 8fee265
Refactor
EyalDelarea ed30c5d
Change to manual trigger
EyalDelarea f4f78e1
Upload artifact
EyalDelarea 8e3c73b
Fix syntax
EyalDelarea 52700fa
Use build script
EyalDelarea 8b091d8
Update builders
EyalDelarea 456d5d3
Add commit constraint
EyalDelarea 235cf3c
Add commit constraint
EyalDelarea 94ad9cd
Fix
EyalDelarea f3b46d6
update github script
EyalDelarea 14dac7e
Bump version from 1.0.0 to 2.0.0
EyalDelarea eb7e99b
Debug
EyalDelarea 4165736
Bump version from 1.0.0 to 2.0.0
EyalDelarea f3d3d9c
Bump version 1.0.0 to 2.0.0
EyalDelarea 1fec8ad
Bump version from 1.0.0 to 2.0.0
EyalDelarea d7a965a
Bump version from 1.0.0 to 2.0.0
EyalDelarea df84972
test commit
EyalDelarea d4c1bf3
Bump version from 1.0.0 to 2.0.0
EyalDelarea f57d392
Bump version from 1.0.0 to 2.0.0
EyalDelarea bdf0e3c
Bump version from 1.0.0 to 2.0.0
EyalDelarea 819e49c
Bump version from 1.0.0 to 2.0.0
EyalDelarea 81bc53a
Test
EyalDelarea f6165e6
Test vars
EyalDelarea e1fe670
Simplify
EyalDelarea 2d14065
Update signMacOsBinaries.yml
EyalDelarea c874f15
Export env
EyalDelarea 089e03a
Test Delete old artifacts
EyalDelarea 85cb329
Test Delete old artifacts
EyalDelarea 9f3b55c
Fix syntax
EyalDelarea 42a3494
Fix syntax
EyalDelarea a219287
Refactor
EyalDelarea 852b7bf
Refactor
EyalDelarea 0ba3e2d
Refactor
EyalDelarea 4c40e2e
Test
EyalDelarea 7cc9cfd
Test
EyalDelarea 6ab6ffd
bump version from 1.2.3 to 4.5.6
EyalDelarea d9772f8
bump version from 1.2.3 to 4.5.7
EyalDelarea 0f42530
Bump version from 0.0.0 to 1.2.2
EyalDelarea 6c0cb07
Bump version from 0.0.0 to 1.2.3
EyalDelarea d3bbcf7
Bump version from 0.0.0 to 1.5.3
EyalDelarea efabc1c
Bump version from 0.0.0 to 1.5.3
EyalDelarea 56f11a3
Bump version from 1.0.0 to 1.5.3
EyalDelarea e9b1163
Bump version from 1.4.0 to 1.5.3
EyalDelarea ce65eb8
Bump version from 1.4.0 to 1.5.3
EyalDelarea 7df4d90
Bump version from 1.4.0 to 1.5.3
EyalDelarea 42664c0
Bump version from 1.4.0 to 1.5.3
EyalDelarea cb8e65f
Bump version from 0.0.0 to 5.5.5
EyalDelarea 01e882a
Bump version from 0.0.0 to 5.5.5
EyalDelarea 7c9650f
Bump version from 0.0.0 to 5.54.5
EyalDelarea 51bcf47
Bump version from 0.0.0 to 5.54.5
EyalDelarea de619ff
Add jenkinsfile
EyalDelarea 6c57c90
Add comments
EyalDelarea a96e5e1
Add a warning message
EyalDelarea bc5c49e
filter on v2 branch
EyalDelarea 905937c
add v2 ref
EyalDelarea 669f447
Merge branch 'dev' of https://github.com/jfrog/jfrog-cli into sign_ap…
EyalDelarea af07521
Merge branch 'dev' of https://github.com/jfrog/jfrog-cli into sign_ap…
EyalDelarea dbdd2e6
Extract signed binary to var
EyalDelarea 8377e15
Extract binary name
EyalDelarea d4a00d0
Bump version from 1.0.0 to 2.0.0
EyalDelarea 3f136c7
Enable debugging workflow
EyalDelarea 37946da
Enable debugging workflow
EyalDelarea f4cb601
Test
EyalDelarea 66182f2
Bump version from 1.0.0 to 2.0.0
EyalDelarea ccb6dbf
Bump version from 1.0.0 to 2.0.0
EyalDelarea 29706fb
Bump version from 1.0.0 to 2.0.0
EyalDelarea d6955c1
Bump version from 1.0.0 to 2.0.0
EyalDelarea feb77c5
Bump version from 1.0.0 to 2.1.2
EyalDelarea b213b8e
Bump version from 1.0.0 to 2.1.3
EyalDelarea e48ede3
Bump version from 1.0.0 to 3.1.3
EyalDelarea eaf0878
add bundle template
EyalDelarea 0721add
Bump version from 1.0.0 to 2.0.0
EyalDelarea e81dd61
Bump version from 1.0.0 to 5.1.3
EyalDelarea 25151e0
Bump version from 1.0.0 to 4.1.3
EyalDelarea 7ba8d63
Bump version from 1.0.0 to 3.1.3
EyalDelarea ff3aad1
Bump version from 1.0.0 to 1.1.3
EyalDelarea 97bd158
Bump version from 1.0.0 to 1.1.5
EyalDelarea 61e31bf
Bump version from 1.0.0 to 1.1.8
EyalDelarea 1862e9d
Bump version from 1.0.0 to 2.60.0
EyalDelarea 9f727c1
Bump version from 1.0.0 to 2.61.0
EyalDelarea 6389c2a
Bump version from 1.0.0 to 2.63.0
EyalDelarea 3ca8070
Bump version from 1.0.0 to 2.64.0
EyalDelarea 083d6a1
Bump version from 1.0.0 to 2.64.0
EyalDelarea 49f92a1
Bump version from 1.0.0 to 2.64.0
EyalDelarea 11f1765
Bump version from 1.0.0 to 2.64.0
EyalDelarea a498b9a
Bump version from 1.0.0 to 2.64.0
EyalDelarea b100e98
Add comments
EyalDelarea 70d3801
Bump version from 1.0.0 to 1.0.1
EyalDelarea 8ce0d2e
Bump version from 1.0.0 to 1.0.2
EyalDelarea ead16c0
Bump version from 1.0.0 to 1.0.3
EyalDelarea 706cd5f
Bump version from 1.0.0 to 1.0.3
EyalDelarea 3f5cec0
Bump version from 1.0.0 to 1.0.3
EyalDelarea 8d56246
Bump version from 1.0.0 to 1.0.3
EyalDelarea 1484404
Bump version from 1.0.0 to 1.0.3
EyalDelarea 52e3b20
Remove deletion of old artifacts
EyalDelarea 83284ea
Bump version from 1.0.0 to 2.0.0
EyalDelarea d5a6101
Change to workflow dispatch
EyalDelarea 24bc798
Change name
EyalDelarea bd3bc8f
Validate Script
EyalDelarea 51318d4
Test init
EyalDelarea 9334e4d
fix workflow
EyalDelarea 5a3bef3
fix workflow
EyalDelarea 92d878b
fix workflow
EyalDelarea 4fd11a9
fix workflow
EyalDelarea 3723ab7
fix workflow
EyalDelarea bb743b2
Fix binary file name
EyalDelarea ad98ce0
Fix jenkins file
EyalDelarea cfbe901
Split by binary name
EyalDelarea e5ab4ba
Add binary name to build
EyalDelarea 27fac9e
Add binary name to build
EyalDelarea 182c4b1
Fail if no artifacts were uploaded
EyalDelarea 91c4c20
Merge remote-tracking branch 'origin/dev' into dev
EyalDelarea 688b696
Fix name
EyalDelarea 887d372
Test
EyalDelarea ace821f
Fix app name
EyalDelarea 1c50c2f
add sign macos binaries to Jenkinsfile
EyalDelarea 22a7aca
Fix upload path
EyalDelarea 0874203
Move the stage to start of release
EyalDelarea a941b6f
Fix executable name
EyalDelarea a7c9bff
Download by executable name as well
EyalDelarea 546c44a
Rename
EyalDelarea e3667a0
Fix var name
EyalDelarea adfef6e
Don't modify app_template path & remove binary_name var
EyalDelarea fd39bdb
Move binary to template
EyalDelarea 063ef54
Remove Binary file name input
EyalDelarea b4f52ca
Make use of temp dir
EyalDelarea bbf165a
Move binary to template
EyalDelarea 9ec0abc
Remove echos
EyalDelarea 91965ba
Setup
EyalDelarea 303d604
Fix copy signed binary
EyalDelarea 9805f64
prepare
EyalDelarea 090016a
extract binary
EyalDelarea 27df1cf
Update prepareDarwinBinariesForRelease.yml
EyalDelarea c83b416
logs
EyalDelarea 350894d
Merge remote-tracking branch 'origin/dev' into dev
EyalDelarea e0c15c1
test
EyalDelarea bafd3b8
test
EyalDelarea 13fdd11
Refactor
EyalDelarea 9917c58
Refactor
EyalDelarea 5d092cb
Checkout branch
EyalDelarea 313c288
Checkout branch
EyalDelarea 628cb1e
Remove git ignores
EyalDelarea fb7aaa1
Fix function call
EyalDelarea bb98ee6
Add README.md files
EyalDelarea 72376ce
Refactor
EyalDelarea 92c9431
Matrix
EyalDelarea c34f055
Move script
EyalDelarea e8c32ad
Extract scripts and refactor
EyalDelarea ab4231c
Fix script path calling
EyalDelarea 727a8c6
Refactor
EyalDelarea 3557968
CR
EyalDelarea 48f1f0c
Renames
EyalDelarea dbed479
Refactor script
EyalDelarea 24f4838
Rename folder
EyalDelarea b16d2ec
Refactor script
EyalDelarea c4cb494
CR
EyalDelarea b0d4ea1
test script
EyalDelarea b50bef1
test script
EyalDelarea d616c5f
Refactor functions
EyalDelarea 4342c49
Remove token unused
EyalDelarea 4ae3ad3
Test script
EyalDelarea f108e00
test
EyalDelarea 1c9a20d
Update Jenkinsfile
EyalDelarea 3316d00
Update Jenkinsfile
EyalDelarea e431c4e
Merge branch 'dev' of https://github.com/jfrog/jfrog-cli into sign_ap…
EyalDelarea 58dca07
Merge branch 'dev' of https://github.com/jfrog/jfrog-cli into sign_ap…
EyalDelarea 5af95fe
CR
EyalDelarea 680420e
Merge branch 'dev' of https://github.com/jfrog/jfrog-cli into sign_ap…
EyalDelarea fae2078
CR
EyalDelarea File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,57 @@ | ||
name: Sign Darwin Binaries for Release | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
releaseVersion: | ||
description: "Release version" | ||
required: true | ||
binaryFileName: | ||
description: 'Binary file name' | ||
required: true | ||
env: | ||
binaryFileName: ${{ github.event.inputs.binaryFileName }} | ||
releaseVersion: ${{ github.event.inputs.releaseVersion }} | ||
jobs: | ||
# Builds, signs, notarize and uploads the macOS binaries | ||
prepareBinary: | ||
name: Prepare-Binary | ||
runs-on: macos-latest | ||
strategy: | ||
matrix: | ||
goarch: [ arm64, amd64 ] | ||
steps: | ||
# Setup | ||
- name: Setup Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.23.x | ||
cache: false | ||
|
||
- name: Checkout Source | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: sign_apple_binary | ||
|
||
# Builds the executable and moves it inside the app template | ||
- name: Build and Move Executable | ||
run: | | ||
./build/build.sh ${{ env.binaryFileName }} | ||
mv ${{ env.binaryFileName }} ./build/apple_release/${{ env.binaryFileName }}.app/Contents/MacOS | ||
|
||
- name: Sign & Notarize | ||
env: | ||
APPLE_CERT_DATA: ${{ secrets.APPLE_CERT_DATA }} | ||
APPLE_CERT_PASSWORD: ${{ secrets.APPLE_CERT_PASSWORD }} | ||
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | ||
APPLE_ACCOUNT_ID: ${{ secrets.APPLE_ACCOUNT_ID }} | ||
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} | ||
APP_TEMPLATE_PATH: ./build/apple_release/${{ env.binaryFileName }}.app | ||
run: ./build/apple_release/scripts/darwin-sign-and-notarize.sh | ||
|
||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ env.binaryFileName }}-darwin-v${{ env.releaseVersion }}-${{ matrix.goarch }} | ||
path: ./${{ env.binaryFileName }} | ||
retention-days: 1 | ||
if-no-files-found: error |
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
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>CFBundleDevelopmentRegion</key> | ||
<string>en-US</string> | ||
<key>CFBundleName</key> | ||
<string>JFrog-CLI</string> | ||
<key>CFBundleDisplayName</key> | ||
<string>JFrog-CLI</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.jfrog.jfrog-cli</string> | ||
</dict> | ||
</plist> |
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,32 @@ | ||
# Apple Bundle Structure README | ||
|
||
This README file serves as a guide to maintaining the integrity of the Apple bundle structure required for macOS applications. It is crucial to keep this file and adhere to the outlined structure to ensure the application functions correctly on macOS. | ||
|
||
## Structure Overview | ||
|
||
The Apple bundle for a macOS application typically has the following directory structure:### Key Components | ||
``` | ||
YOUR_APP.app | ||
├── Contents | ||
├── MacOS | ||
│ └── YOUR_APP (executable file) | ||
└── Info.plist | ||
|
||
``` | ||
- **YOUR_APP.app**: This is the root directory of your application bundle. Replace `YOUR_APP` with the name of your application. | ||
|
||
- **Contents**: A mandatory directory that contains all the files needed by the application. | ||
|
||
- **MacOS**: This directory should contain the executable file for your application. The name of the executable should match the `YOUR_APP` part of your application bundle's name. | ||
|
||
- **Info.plist**: A required file that contains configuration and permissions for your application. It informs the macOS about how your app should be treated and what capabilities it has. | ||
|
||
### Important Notes | ||
|
||
- **Do Not Delete**: This README file and the structure it describes are essential for the application's deployment and functionality on macOS. Removing or altering the structure may result in application failures. | ||
|
||
- **Executable File**: Ensure your application's executable file is placed inside the `MacOS` directory. The executable's name must match the `YOUR_APP` portion of your application bundle's name for macOS to recognize and launch it correctly. | ||
|
||
- **Info.plist Configuration**: Properly configure the `Info.plist` file according to your application's needs. This file includes critical information such as the app version, display name, permissions, and more. | ||
|
||
By adhering to this structure and guidelines, you ensure that your macOS application is packaged correctly for distribution and use. |
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,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>CFBundleDevelopmentRegion</key> | ||
<string>en-US</string> | ||
<key>CFBundleName</key> | ||
<string>JFrog-CLI</string> | ||
<key>CFBundleDisplayName</key> | ||
<string>JFrog-CLI</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.jfrog.jfrog-cli</string> | ||
</dict> | ||
</plist> |
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,32 @@ | ||
# Apple Bundle Structure README | ||
|
||
This README file serves as a guide to maintaining the integrity of the Apple bundle structure required for macOS applications. It is crucial to keep this file and adhere to the outlined structure to ensure the application functions correctly on macOS. | ||
|
||
## Structure Overview | ||
|
||
The Apple bundle for a macOS application typically has the following directory structure:### Key Components | ||
``` | ||
YOUR_APP.app | ||
├── Contents | ||
├── MacOS | ||
│ └── YOUR_APP (executable file) | ||
└── Info.plist | ||
|
||
``` | ||
- **YOUR_APP.app**: This is the root directory of your application bundle. Replace `YOUR_APP` with the name of your application. | ||
|
||
- **Contents**: A mandatory directory that contains all the files needed by the application. | ||
|
||
- **MacOS**: This directory should contain the executable file for your application. The name of the executable should match the `YOUR_APP` part of your application bundle's name. | ||
|
||
- **Info.plist**: A required file that contains configuration and permissions for your application. It informs the macOS about how your app should be treated and what capabilities it has. | ||
|
||
### Important Notes | ||
|
||
- **Do Not Delete**: This README file and the structure it describes are essential for the application's deployment and functionality on macOS. Removing or altering the structure may result in application failures. | ||
|
||
- **Executable File**: Ensure your application's executable file is placed inside the `MacOS` directory. The executable's name must match the `YOUR_APP` portion of your application bundle's name for macOS to recognize and launch it correctly. | ||
|
||
- **Info.plist Configuration**: Properly configure the `Info.plist` file according to your application's needs. This file includes critical information such as the app version, display name, permissions, and more. | ||
|
||
By adhering to this structure and guidelines, you ensure that your macOS application is packaged correctly for distribution and use. |
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,99 @@ | ||
#!/bin/bash | ||
|
||
# Script Purpose: Automate the process of signing and notarizing a macOS binary. | ||
|
||
# Input: | ||
# - APPLE_CERT_DATA: Base64 encoded data of the Apple Developer certificate. | ||
# - APPLE_CERT_PASSWORD: Password for the Apple Developer certificate. | ||
# - APPLE_TEAM_ID: Identifier for the Apple Developer Team. | ||
# - APPLE_ACCOUNT_ID: Apple Developer Account ID. | ||
# - APPLE_APP_SPECIFIC_PASSWORD: Password for app-specific services on the Apple Developer Account. | ||
# - APP_TEMPLATE_PATH: Path to the .app bundle template. | ||
|
||
# Output: | ||
# A signed and notarized binary file in the current directory, ready for distribution. | ||
|
||
validate_app_template_structure() { | ||
[ ! -d "$APP_TEMPLATE_PATH" ] && { echo "Error: $APP_TEMPLATE_PATH directory does not exist."; exit 1; } | ||
[ ! -d "$APP_TEMPLATE_PATH/Contents" ] && { echo "Error: Contents directory does not exist in $APP_TEMPLATE_PATH."; exit 1; } | ||
[ ! -d "$APP_TEMPLATE_PATH/Contents/MacOS" ] && { echo "Error: MacOS directory does not exist in $APP_TEMPLATE_PATH/Contents."; exit 1; } | ||
[ ! -f "$APP_TEMPLATE_PATH/Contents/Info.plist" ] && { echo "Error: Info.plist file does not exist in $APP_TEMPLATE_PATH/Contents."; exit 1; } | ||
|
||
local app_name_without_extension | ||
app_name_without_extension=$(basename "$APP_TEMPLATE_PATH" .app) | ||
export BINARY_FILE_NAME=$app_name_without_extension | ||
|
||
[ ! -f "$APP_TEMPLATE_PATH/Contents/MacOS/$BINARY_FILE_NAME" ] && { echo "Error: $BINARY_FILE_NAME executable not found inside the MacOS folder."; exit 1; } | ||
} | ||
|
||
validate_inputs() { | ||
[ -z "$APPLE_CERT_DATA" ] && { echo "Error: Missing APPLE_CERT_DATA environment variable."; exit 1; } | ||
[ -z "$APPLE_CERT_PASSWORD" ] && { echo "Error: Missing APPLE_CERT_PASSWORD environment variable."; exit 1; } | ||
[ -z "$APPLE_TEAM_ID" ] && { echo "Error: Missing APPLE_TEAM_ID environment variable."; exit 1; } | ||
|
||
validate_app_template_structure | ||
} | ||
|
||
prepare_keychain_and_certificate() { | ||
local temp_dir | ||
temp_dir=$(mktemp -d) | ||
local keychain_name="macos-build.keychain" | ||
|
||
echo "$APPLE_CERT_DATA" | base64 --decode > "$temp_dir/certs.p12" | ||
|
||
security create-keychain -p "$APPLE_CERT_PASSWORD" $keychain_name | ||
security default-keychain -s $keychain_name | ||
security unlock-keychain -p "$APPLE_CERT_PASSWORD" $keychain_name | ||
security set-keychain-settings -t 3600 -u $keychain_name | ||
|
||
security import "$temp_dir/certs.p12" -k ~/Library/Keychains/$keychain_name -P "$APPLE_CERT_PASSWORD" -T /usr/bin/codesign || { echo "Error: Failed to import certificate into keychain."; exit 1; } | ||
|
||
security set-key-partition-list -S apple-tool:,apple: -s -k "$APPLE_CERT_PASSWORD" -D "$APPLE_TEAM_ID" -t private $keychain_name | ||
} | ||
|
||
sign_binary() { | ||
codesign -s "$APPLE_TEAM_ID" --timestamp --deep --options runtime --force "$APP_TEMPLATE_PATH/Contents/MacOS/$BINARY_FILE_NAME" || { echo "Error: Failed to sign the binary."; exit 1; } | ||
echo "Successfully signed the binary." | ||
} | ||
|
||
notarize_app() { | ||
local temp_dir | ||
temp_dir=$(mktemp -d) | ||
local current_dir | ||
current_dir=$(pwd) | ||
|
||
cp -r "$APP_TEMPLATE_PATH" "$temp_dir" | ||
cd "$temp_dir" || exit | ||
|
||
local temp_zipped_name="${BINARY_FILE_NAME}-zipped.zip" | ||
ditto -c -k --keepParent "$BINARY_FILE_NAME.app" "./$temp_zipped_name" || { echo "Error: Failed to zip the app."; exit 1; } | ||
|
||
xcrun notarytool submit "$temp_zipped_name" --apple-id "$APPLE_ACCOUNT_ID" --team-id "$APPLE_TEAM_ID" --password "$APPLE_APP_SPECIFIC_PASSWORD" --wait || { echo "Error: Failed to notarize the app."; exit 1; } | ||
echo "Notarization successful." | ||
|
||
unzip -o "$temp_zipped_name" | ||
xcrun stapler staple "$BINARY_FILE_NAME.app" || { echo "Error: Failed to staple the ticket to the app."; exit 1; } | ||
echo "Stapling successful." | ||
|
||
cp "./$BINARY_FILE_NAME.app/Contents/MacOS/$BINARY_FILE_NAME" "$current_dir" | ||
cd "$current_dir" || exit | ||
rm -rf "$temp_dir" | ||
} | ||
|
||
# Cleans up resources used during the process. | ||
cleanup() { | ||
echo "Deleting keychain..." | ||
security delete-keychain "macos-build.keychain" | ||
echo "Deleting temporary certificate files..." | ||
rm -rf "$temp_dir/certs.p12" | ||
} | ||
|
||
main() { | ||
validate_inputs | ||
prepare_keychain_and_certificate | ||
sign_binary | ||
notarize_app | ||
cleanup | ||
} | ||
|
||
main |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is listed under the TODO before merge as it can't run on dev branch as it missing the apple_release folder