Update OSX codesigning and notarization (#3658)

This commit is contained in:
Finn
2025-07-30 11:05:37 -07:00
committed by GitHub
parent be6c599063
commit b4aa2cd3ab
7 changed files with 146 additions and 185 deletions
+70 -66
View File
@@ -26,20 +26,7 @@ on:
required: false required: false
default: '' default: ''
secrets: secrets:
CERTIFICATE_OSX_APPLICATION: OSX_CODESIGN_ROLE:
description: 'Certificate for macOS application signing'
required: false
CERTIFICATE_PASSWORD:
description: 'Password for the macOS certificate'
required: false
APPLE_ID:
description: 'Apple ID for notarization'
required: false
APPLE_ID_PASSWORD:
description: 'Password for the Apple ID'
required: false
APPLE_TEAM_ID:
description: 'Apple Team ID'
required: false required: false
name: Reusable workflow to bundle desktop app for Intel Mac name: Reusable workflow to bundle desktop app for Intel Mac
@@ -48,37 +35,14 @@ jobs:
bundle-desktop-intel: bundle-desktop-intel:
runs-on: macos-latest runs-on: macos-latest
name: Bundle Desktop App on Intel macOS name: Bundle Desktop App on Intel macOS
permissions:
id-token: write
contents: read
steps: steps:
# Check initial disk space # Check initial disk space
- name: Check initial disk space - name: Check initial disk space
run: df -h run: df -h
# Validate Signing Secrets if signing is enabled
- name: Validate Signing Secrets
if: ${{ inputs.signing }}
run: |
if [[ -z "${{ secrets.CERTIFICATE_OSX_APPLICATION }}" ]]; then
echo "Error: CERTIFICATE_OSX_APPLICATION secret is required for signing."
exit 1
fi
if [[ -z "${{ secrets.CERTIFICATE_PASSWORD }}" ]]; then
echo "Error: CERTIFICATE_PASSWORD secret is required for signing."
exit 1
fi
if [[ -z "${{ secrets.APPLE_ID }}" ]]; then
echo "Error: APPLE_ID secret is required for signing."
exit 1
fi
if [[ -z "${{ secrets.APPLE_ID_PASSWORD }}" ]]; then
echo "Error: APPLE_ID_PASSWORD secret is required for signing."
exit 1
fi
if [[ -z "${{ secrets.APPLE_TEAM_ID }}" ]]; then
echo "Error: APPLE_TEAM_ID secret is required for signing."
exit 1
fi
echo "All required signing secrets are present."
- name: Checkout code - name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with: with:
@@ -186,14 +150,6 @@ jobs:
cp temporal-service/temporal-service ui/desktop/src/bin/temporal-service cp temporal-service/temporal-service ui/desktop/src/bin/temporal-service
cp bin/temporal ui/desktop/src/bin/temporal cp bin/temporal ui/desktop/src/bin/temporal
- name: Add MacOS certs for signing and notarization
if: ${{ inputs.signing }}
run: ./scripts/add-macos-cert.sh
working-directory: ui/desktop
env:
CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }}
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
- name: Install dependencies - name: Install dependencies
run: source ../../bin/activate-hermit && npm ci run: source ../../bin/activate-hermit && npm ci
working-directory: ui/desktop working-directory: ui/desktop
@@ -209,8 +165,7 @@ jobs:
- name: Check disk space before bundling - name: Check disk space before bundling
run: df -h run: df -h
- name: Make Unsigned App - name: Build App
if: ${{ !inputs.signing }}
run: | run: |
source ../../bin/activate-hermit source ../../bin/activate-hermit
attempt=0 attempt=0
@@ -227,27 +182,76 @@ jobs:
fi fi
working-directory: ui/desktop working-directory: ui/desktop
- name: Make Signed App - name: Configure AWS credentials
if: ${{ inputs.signing }}
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4
with:
role-to-assume: "${{ secrets.OSX_CODESIGN_ROLE }}"
aws-region: us-west-2
- name: Codesigning and Notarization
if: ${{ inputs.signing }} if: ${{ inputs.signing }}
run: | run: |
source ../../bin/activate-hermit set -e
attempt=0
max_attempts=2 echo "⬆️ uploading unsigned app"
until [ $attempt -ge $max_attempts ]; do source_job_url="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
npm run bundle:intel && break unsigned_url="s3://block-goose-artifacts-bucket-production/unsigned/goose-${GITHUB_SHA}-${{ github.run_id }}-intel.zip"
attempt=$((attempt + 1))
echo "Attempt $attempt failed. Retrying..." zip -q -u -r out/Goose-darwin-x64/Goose_intel_mac.zip entitlements.plist
sleep 5
done # upload unsigned goose to transfer bucket so it can be passed to lambda
if [ $attempt -ge $max_attempts ]; then aws s3 cp --quiet out/Goose-darwin-x64/Goose_intel_mac.zip "${unsigned_url}"
echo "Action failed after $max_attempts attempts."
# begin signing
echo "🚀 launching signing process"
aws lambda invoke \
--function-name codesign_helper \
--cli-binary-format raw-in-base64-out \
--payload "{\"source_s3_url\": \"${unsigned_url}\", \"source_job_url\": \"${source_job_url}\"}" \
response.json > /dev/null
if [ "$(jq -r .statusCode response.json)" != "200" ]; then
echo "⚠️ lambda function did not return expected status code"
exit 1 exit 1
fi fi
build_number="$(jq -r .body.build_number response.json)"
start_time=$(date +%s)
while sleep 30; do
aws lambda invoke \
--function-name codesign_helper \
--cli-binary-format raw-in-base64-out \
--payload "{\"source_s3_url\": \"${unsigned_url}\", \"build_number\": \"${build_number}\"}" \
response.json > /dev/null
if [ "$(jq -r .statusCode response.json)" != "200" ]; then
echo "⚠️ signing request returned unexpected response code $(jq -r .statusCode response.json):"
jq . response.json
exit 1
fi
if [ "$(jq -r .body.state response.json)" == "completed" ]; then
echo "✅ signing complete ($(($(date +%s) - start_time))s)"
break
fi
if [ $(($(date +%s) - start_time)) -ge 900 ]; then
echo "⚠️ timed out ($(($(date +%s) - start_time))s)"
exit 1
fi
echo "⏲️ waiting for signing to complete ($(($(date +%s) - start_time))s)"
done
# parse lambda response
signed_url=$(jq -r .body.destination_url response.json)
# download the signed app from S3
echo "⬇️ downloading signed app"
aws s3 cp --quiet "${signed_url}" out/Goose-darwin-x64/Goose_intel_mac.zip
working-directory: ui/desktop working-directory: ui/desktop
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
- name: Final cleanup before artifact upload - name: Final cleanup before artifact upload
run: | run: |
+70 -65
View File
@@ -27,20 +27,7 @@ on:
type: string type: string
default: '' default: ''
secrets: secrets:
CERTIFICATE_OSX_APPLICATION: OSX_CODESIGN_ROLE:
description: 'Certificate for macOS application signing'
required: false
CERTIFICATE_PASSWORD:
description: 'Password for the macOS certificate'
required: false
APPLE_ID:
description: 'Apple ID for notarization'
required: false
APPLE_ID_PASSWORD:
description: 'Password for the Apple ID'
required: false
APPLE_TEAM_ID:
description: 'Apple Team ID'
required: false required: false
name: Reusable workflow to bundle desktop app name: Reusable workflow to bundle desktop app
@@ -49,6 +36,9 @@ jobs:
bundle-desktop: bundle-desktop:
runs-on: macos-latest runs-on: macos-latest
name: Bundle Desktop App on macOS name: Bundle Desktop App on macOS
permissions:
id-token: write
contents: read
steps: steps:
# Debug information about the workflow and inputs # Debug information about the workflow and inputs
- name: Debug workflow info - name: Debug workflow info
@@ -78,31 +68,6 @@ jobs:
- name: Check initial disk space - name: Check initial disk space
run: df -h run: df -h
# Validate Signing Secrets if signing is enabled
- name: Validate Signing Secrets
if: ${{ inputs.signing }}
env:
HAS_CERT: ${{ secrets.CERTIFICATE_OSX_APPLICATION != '' }}
HAS_CERT_PASS: ${{ secrets.CERTIFICATE_PASSWORD != '' }}
HAS_APPLE_ID: ${{ secrets.APPLE_ID != '' }}
HAS_APPLE_PASS: ${{ secrets.APPLE_ID_PASSWORD != '' }}
HAS_TEAM_ID: ${{ secrets.APPLE_TEAM_ID != '' }}
run: |
missing=()
[[ "${HAS_CERT}" != "true" ]] && missing+=("CERTIFICATE_OSX_APPLICATION")
[[ "${HAS_CERT_PASS}" != "true" ]] && missing+=("CERTIFICATE_PASSWORD")
[[ "${HAS_APPLE_ID}" != "true" ]] && missing+=("APPLE_ID")
[[ "${HAS_APPLE_PASS}" != "true" ]] && missing+=("APPLE_ID_PASSWORD")
[[ "${HAS_TEAM_ID}" != "true" ]] && missing+=("APPLE_TEAM_ID")
if (( ${#missing[@]} > 0 )); then
echo "Error: Missing required signing secrets:"
printf '%s\n' "${missing[@]}"
exit 1
fi
echo "All required signing secrets are present."
- name: Checkout code - name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with: with:
@@ -224,14 +189,6 @@ jobs:
cp temporal-service/temporal-service ui/desktop/src/bin/temporal-service cp temporal-service/temporal-service ui/desktop/src/bin/temporal-service
cp bin/temporal ui/desktop/src/bin/temporal cp bin/temporal ui/desktop/src/bin/temporal
- name: Add MacOS certs for signing and notarization
if: ${{ inputs.signing }}
run: ./scripts/add-macos-cert.sh
working-directory: ui/desktop
env:
CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }}
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
- name: Install dependencies - name: Install dependencies
run: source ../../bin/activate-hermit && npm ci run: source ../../bin/activate-hermit && npm ci
working-directory: ui/desktop working-directory: ui/desktop
@@ -240,8 +197,7 @@ jobs:
- name: Check disk space before bundling - name: Check disk space before bundling
run: df -h run: df -h
- name: Make Unsigned App - name: Build App
if: ${{ !inputs.signing }}
run: | run: |
source ../../bin/activate-hermit source ../../bin/activate-hermit
attempt=0 attempt=0
@@ -258,26 +214,75 @@ jobs:
fi fi
working-directory: ui/desktop working-directory: ui/desktop
- name: Make Signed App - name: Configure AWS credentials
if: ${{ inputs.signing }} if: ${{ inputs.signing }}
env: uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4
APPLE_ID: ${{ secrets.APPLE_ID }} with:
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} role-to-assume: "${{ secrets.OSX_CODESIGN_ROLE }}"
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} aws-region: us-west-2
run: |
attempt=0 - name: Codesigning and Notarization
max_attempts=2 if: ${{ inputs.signing }}
until [ $attempt -ge $max_attempts ]; do run: |
npm run bundle:default && break set -e
attempt=$((attempt + 1))
echo "Attempt $attempt failed. Retrying..." echo "⬆️ uploading unsigned app"
sleep 5 source_job_url="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
done unsigned_url="s3://block-goose-artifacts-bucket-production/unsigned/goose-${GITHUB_SHA}-${{ github.run_id }}-arm64.zip"
if [ $attempt -ge $max_attempts ]; then
echo "Action failed after $max_attempts attempts." zip -q -u -r out/Goose-darwin-arm64/Goose.zip entitlements.plist
# upload unsigned goose to transfer bucket so it can be passed to lambda
aws s3 cp --quiet out/Goose-darwin-arm64/Goose.zip "${unsigned_url}"
# begin signing
echo "🚀 launching signing process"
aws lambda invoke \
--function-name codesign_helper \
--cli-binary-format raw-in-base64-out \
--payload "{\"source_s3_url\": \"${unsigned_url}\", \"source_job_url\": \"${source_job_url}\"}" \
response.json > /dev/null
if [ "$(jq -r .statusCode response.json)" != "200" ]; then
echo "⚠️ lambda function did not return expected status code"
exit 1 exit 1
fi fi
build_number="$(jq -r .body.build_number response.json)"
start_time=$(date +%s)
while sleep 30; do
aws lambda invoke \
--function-name codesign_helper \
--cli-binary-format raw-in-base64-out \
--payload "{\"source_s3_url\": \"${unsigned_url}\", \"build_number\": \"${build_number}\"}" \
response.json > /dev/null
if [ "$(jq -r .statusCode response.json)" != "200" ]; then
echo "⚠️ signing request returned unexpected response code $(jq -r .statusCode response.json):"
jq . response.json
exit 1
fi
if [ "$(jq -r .body.state response.json)" == "completed" ]; then
echo "✅ signing complete ($(($(date +%s) - start_time))s)"
break
fi
if [ $(($(date +%s) - start_time)) -ge 900 ]; then
echo "⚠️ timed out ($(($(date +%s) - start_time))s)"
exit 1
fi
echo "⏲️ waiting for signing to complete ($(($(date +%s) - start_time))s)"
done
# parse lambda response
signed_url=$(jq -r .body.destination_url response.json)
# download the signed app from S3
echo "⬇️ downloading signed app"
aws s3 cp --quiet "${signed_url}" out/Goose-darwin-arm64/Goose.zip
working-directory: ui/desktop working-directory: ui/desktop
- name: Final cleanup before artifact upload - name: Final cleanup before artifact upload
+2 -12
View File
@@ -67,13 +67,7 @@ jobs:
uses: ./.github/workflows/bundle-desktop.yml uses: ./.github/workflows/bundle-desktop.yml
with: with:
version: ${{ needs.prepare-version.outputs.version }} version: ${{ needs.prepare-version.outputs.version }}
signing: true signing: false
secrets:
CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }}
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
# ------------------------------------------------------------ # ------------------------------------------------------------
# 5) Bundle Desktop App (Linux) - builds goosed and Electron app # 5) Bundle Desktop App (Linux) - builds goosed and Electron app
@@ -92,11 +86,7 @@ jobs:
uses: ./.github/workflows/bundle-desktop-windows.yml uses: ./.github/workflows/bundle-desktop-windows.yml
with: with:
version: ${{ needs.prepare-version.outputs.version }} version: ${{ needs.prepare-version.outputs.version }}
signing: true signing: false
secrets:
WINDOWS_CODESIGN_CERTIFICATE: ${{ secrets.WINDOWS_CODESIGN_CERTIFICATE }}
WINDOW_SIGNING_ROLE: ${{ secrets.WINDOW_SIGNING_ROLE }}
WINDOW_SIGNING_ROLE_TAG: ${{ secrets.WINDOW_SIGNING_ROLE_TAG }}
# ------------------------------------ # ------------------------------------
# 7) Create/Update GitHub Release # 7) Create/Update GitHub Release
@@ -64,14 +64,8 @@ jobs:
if: ${{ needs.trigger-on-command.outputs.continue == 'true' }} if: ${{ needs.trigger-on-command.outputs.continue == 'true' }}
uses: ./.github/workflows/bundle-desktop-intel.yml uses: ./.github/workflows/bundle-desktop-intel.yml
with: with:
signing: true signing: false
ref: ${{ needs.trigger-on-command.outputs.head_sha }} ref: ${{ needs.trigger-on-command.outputs.head_sha }}
secrets:
CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }}
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
pr-comment-intel: pr-comment-intel:
name: PR Comment with macOS Intel App name: PR Comment with macOS Intel App
+1 -7
View File
@@ -108,14 +108,8 @@ jobs:
if: ${{ needs.trigger-on-command.outputs.continue == 'true' }} if: ${{ needs.trigger-on-command.outputs.continue == 'true' }}
uses: ./.github/workflows/bundle-desktop.yml uses: ./.github/workflows/bundle-desktop.yml
with: with:
signing: true signing: false
ref: ${{ needs.trigger-on-command.outputs.pr_sha }} ref: ${{ needs.trigger-on-command.outputs.pr_sha }}
secrets:
CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }}
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
pr-comment-arm64: pr-comment-arm64:
name: PR Comment with macOS ARM64 App name: PR Comment with macOS ARM64 App
+2 -10
View File
@@ -47,11 +47,7 @@ jobs:
with: with:
signing: true signing: true
secrets: secrets:
CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }} OSX_CODESIGN_ROLE: ${{ secrets.OSX_CODESIGN_ROLE }}
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
# ------------------------------------------------------------ # ------------------------------------------------------------
# 4) Bundle Desktop App (macOS) # 4) Bundle Desktop App (macOS)
@@ -61,11 +57,7 @@ jobs:
with: with:
signing: true signing: true
secrets: secrets:
CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }} OSX_CODESIGN_ROLE: ${{ secrets.OSX_CODESIGN_ROLE }}
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
# ------------------------------------------------------------ # ------------------------------------------------------------
# 5) Bundle Desktop App (Linux) # 5) Bundle Desktop App (Linux)
-18
View File
@@ -33,26 +33,8 @@ let cfg = {
} }
] ]
}, },
// macOS specific configuration
osxSign: {
entitlements: 'entitlements.plist',
'entitlements-inherit': 'entitlements.plist',
'gatekeeper-assess': false,
hardenedRuntime: true,
identity: 'Developer ID Application: Michael Neale (W2L75AE9HQ)',
},
osxNotarize: {
appleId: process.env['APPLE_ID'],
appleIdPassword: process.env['APPLE_ID_PASSWORD'],
teamId: process.env['APPLE_TEAM_ID'],
},
}; };
if (process.env['APPLE_ID'] === undefined) {
delete cfg.osxNotarize;
delete cfg.osxSign;
}
module.exports = { module.exports = {
packagerConfig: cfg, packagerConfig: cfg,
rebuildConfig: {}, rebuildConfig: {},