Skip to content

Commit b3ef97d

Browse files
always resign
1 parent 87a5183 commit b3ef97d

5 files changed

Lines changed: 7 additions & 23 deletions

File tree

dist/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58050,6 +58050,7 @@ const semver = __nccwpck_require__(1383);
5805058050
const AppStoreConnectClient_1 = __nccwpck_require__(7486);
5805158051
const utilities_1 = __nccwpck_require__(5739);
5805258052
const core = __nccwpck_require__(2186);
58053+
const AppleCredential_1 = __nccwpck_require__(4199);
5805358054
const xcodebuild = '/usr/bin/xcodebuild';
5805458055
const xcrun = '/usr/bin/xcrun';
5805558056
const WORKSPACE = process.env.GITHUB_WORKSPACE || process.cwd();
@@ -58542,9 +58543,7 @@ async function createMacOSInstallerPkg(projectRef) {
5854258543
}
5854358544
const developerIdInstallerCert = await (0, AppStoreConnectClient_1.GetCertificate)(projectRef, 'MAC_INSTALLER_DISTRIBUTION');
5854458545
core.info(`Found Developer ID Installer certificate: [${developerIdInstallerCert.id}] ${developerIdInstallerCert.attributes.name}`);
58545-
const certPath = path.join(process.env.RUNNER_TEMP, 'developer_id_installer.cer');
58546-
await fs.promises.writeFile(certPath, developerIdInstallerCert.attributes.certificateContent);
58547-
core.info(`Saved Developer ID Installer certificate to: ${certPath}`);
58546+
await (0, AppleCredential_1.ImportCertificate)(developerIdInstallerCert);
5854858547
const signPkgPath = __nccwpck_require__.ab + "sign-app-pkg.sh";
5854958548
core.info(`Signing pkg: ${pkgPath}`);
5855058549
let codesignOutput = '';

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/sign-app-bundle.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@ SIGNING_IDENTITY="$3"
1212
# remove any metadata from the app bundle
1313
xattr -cr "$APP_BUNDLE_PATH"
1414

15-
# verify the app bundle
16-
if codesign --verify --verbose=2 "$APP_BUNDLE_PATH"; then
17-
echo "App bundle is already signed and verified. skipping..."
18-
exit 0
19-
fi
20-
2115
if [ -z "$SIGNING_IDENTITY" ]; then
2216
# get the signing identity that matches Developer ID Application
2317
SIGNING_IDENTITY=$(security find-identity -p codesigning -v | grep "Developer ID Application" | awk -F'"' '{print $2}' | head -n 1)
@@ -38,6 +32,6 @@ find "$APP_BUNDLE_PATH" -name "*.dylib" -exec codesign --force --verify --verbos
3832
codesign --deep --force --verify --verbose --timestamp --options runtime --entitlements "$ENTITLEMENTS_PATH" --sign "$SIGNING_IDENTITY" "$APP_BUNDLE_PATH"
3933

4034
# verify the app bundle
41-
if ! codesign --verify --verbose=2 "$APP_BUNDLE_PATH"; then
35+
if ! codesign --verify --deep --strict --verbose=2 "$APP_BUNDLE_PATH"; then
4236
exit 1
4337
fi

src/sign-app-bundle.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@ SIGNING_IDENTITY="$3"
1212
# remove any metadata from the app bundle
1313
xattr -cr "$APP_BUNDLE_PATH"
1414

15-
# verify the app bundle
16-
if codesign --verify --verbose=2 "$APP_BUNDLE_PATH"; then
17-
echo "App bundle is already signed and verified. skipping..."
18-
exit 0
19-
fi
20-
2115
if [ -z "$SIGNING_IDENTITY" ]; then
2216
# get the signing identity that matches Developer ID Application
2317
SIGNING_IDENTITY=$(security find-identity -p codesigning -v | grep "Developer ID Application" | awk -F'"' '{print $2}' | head -n 1)
@@ -38,6 +32,6 @@ find "$APP_BUNDLE_PATH" -name "*.dylib" -exec codesign --force --verify --verbos
3832
codesign --deep --force --verify --verbose --timestamp --options runtime --entitlements "$ENTITLEMENTS_PATH" --sign "$SIGNING_IDENTITY" "$APP_BUNDLE_PATH"
3933

4034
# verify the app bundle
41-
if ! codesign --verify --verbose=2 "$APP_BUNDLE_PATH"; then
35+
if ! codesign --verify --deep --strict --verbose=2 "$APP_BUNDLE_PATH"; then
4236
exit 1
4337
fi

src/xcode.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
} from './AppStoreConnectClient';
1717
import { log } from './utilities';
1818
import core = require('@actions/core');
19-
import { AppleCredential } from './AppleCredential';
19+
import { AppleCredential, ImportCertificate } from './AppleCredential';
2020
import { SemVer } from 'semver';
2121

2222
const xcodebuild = '/usr/bin/xcodebuild';
@@ -526,10 +526,7 @@ async function createMacOSInstallerPkg(projectRef: XcodeProject): Promise<string
526526
// TODO get Developer ID Installer signing certificate from app store connect API
527527
const developerIdInstallerCert = await GetCertificate(projectRef, 'MAC_INSTALLER_DISTRIBUTION');
528528
core.info(`Found Developer ID Installer certificate: [${developerIdInstallerCert.id}] ${developerIdInstallerCert.attributes.name}`);
529-
// save certificate contents to runner.temp directory
530-
const certPath = path.join(process.env.RUNNER_TEMP, 'developer_id_installer.cer');
531-
await fs.promises.writeFile(certPath, developerIdInstallerCert.attributes.certificateContent);
532-
core.info(`Saved Developer ID Installer certificate to: ${certPath}`);
529+
await ImportCertificate(developerIdInstallerCert);
533530
// sign the .pkg using ./sign-app-pkg.sh
534531
const signPkgPath = path.join(__dirname, 'sign-app-pkg.sh');
535532
core.info(`Signing pkg: ${pkgPath}`);

0 commit comments

Comments
 (0)