mirror of
https://github.com/BloopAI/apple-code-sign-action.git
synced 2026-10-22 18:08:25 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0074af20c7 |
@@ -22,7 +22,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
id: checkout
|
id: checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
id: checkout
|
id: checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
id: setup-node
|
id: setup-node
|
||||||
@@ -42,7 +42,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
id: checkout
|
id: checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Fetch rcodesign
|
- name: Fetch rcodesign
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
id: checkout
|
id: checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
id: setup-node
|
id: setup-node
|
||||||
|
|||||||
@@ -28,12 +28,8 @@ It is up to the caller to do something with the file/directory operated on.
|
|||||||
See [action.yml](action.yml) for the set of inputs. The file should be
|
See [action.yml](action.yml) for the set of inputs. The file should be
|
||||||
self-documenting.
|
self-documenting.
|
||||||
|
|
||||||
The outputs are:
|
The only output is `output_path`, which holds the filesystem path of the
|
||||||
|
signed/notarized/stapled entity.
|
||||||
- `output_path`: filesystem path of the signed/notarized/stapled entity (or the
|
|
||||||
first path when multiple `input_path` values are provided).
|
|
||||||
- `output_paths`: newline-separated list of output paths when multiple
|
|
||||||
`input_path` values are provided.
|
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
@@ -151,21 +147,3 @@ steps:
|
|||||||
app_store_connect_api_issuer: 'abcdef-42-2411312...'
|
app_store_connect_api_issuer: 'abcdef-42-2411312...'
|
||||||
app_store_connect_api_key: 'DEADBEEF'
|
app_store_connect_api_key: 'DEADBEEF'
|
||||||
```
|
```
|
||||||
|
|
||||||
Notarize multiple signed assets in parallel.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
steps:
|
|
||||||
# Add steps here to materialize signed assets (.app/.zip/.dmg/etc).
|
|
||||||
|
|
||||||
- name: Notarize (parallel)
|
|
||||||
uses: BloopAI/apple-code-sign-action@v1
|
|
||||||
with:
|
|
||||||
input_path: |
|
|
||||||
MyApp.zip
|
|
||||||
MyOtherApp.zip
|
|
||||||
sign: false
|
|
||||||
notarize: true
|
|
||||||
notarize_concurrency: 2
|
|
||||||
app_store_connect_api_key_json_file: app_store_key.json
|
|
||||||
```
|
|
||||||
|
|||||||
+1
-7
@@ -26,10 +26,6 @@ inputs:
|
|||||||
description: 'Whether to notarize'
|
description: 'Whether to notarize'
|
||||||
default: 'false'
|
default: 'false'
|
||||||
|
|
||||||
notarize_concurrency:
|
|
||||||
description: 'Max parallel notarization submissions when input_path is multi-line (0 = unlimited)'
|
|
||||||
default: '0'
|
|
||||||
|
|
||||||
# Attaches a pre-issued "notarization ticket" to an entity.
|
# Attaches a pre-issued "notarization ticket" to an entity.
|
||||||
staple:
|
staple:
|
||||||
description: 'Whether to staple a notarization ticket'
|
description: 'Whether to staple a notarization ticket'
|
||||||
@@ -117,9 +113,7 @@ inputs:
|
|||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
output_path:
|
output_path:
|
||||||
description: 'Path to signed/notarized/stapled entity (first when multiple input_path values)'
|
description: 'Path to signed/notarized/stapled entity'
|
||||||
output_paths:
|
|
||||||
description: 'Newline-separated list of output paths when multiple input_path values are provided'
|
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: node20
|
using: node20
|
||||||
|
|||||||
+6
-189
@@ -27593,49 +27593,6 @@ const exec = __nccwpck_require__(5236)
|
|||||||
const toolCache = __nccwpck_require__(3472)
|
const toolCache = __nccwpck_require__(3472)
|
||||||
const os = __nccwpck_require__(857)
|
const os = __nccwpck_require__(857)
|
||||||
|
|
||||||
async function mapWithConcurrency(items, concurrency, fn) {
|
|
||||||
if (!Number.isInteger(concurrency) || concurrency < 1) {
|
|
||||||
throw new Error('concurrency must be a positive integer')
|
|
||||||
}
|
|
||||||
|
|
||||||
const results = new Array(items.length)
|
|
||||||
let nextIndex = 0
|
|
||||||
|
|
||||||
async function worker() {
|
|
||||||
for (let index = nextIndex++; index < items.length; index = nextIndex++) {
|
|
||||||
results[index] = await fn(items[index], index)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const workers = Array.from(
|
|
||||||
{ length: Math.min(concurrency, items.length) },
|
|
||||||
() => worker()
|
|
||||||
)
|
|
||||||
await Promise.all(workers)
|
|
||||||
|
|
||||||
return results
|
|
||||||
}
|
|
||||||
|
|
||||||
async function execRcodesign(rcodesign, args) {
|
|
||||||
let stdout = ''
|
|
||||||
let stderr = ''
|
|
||||||
|
|
||||||
const exitCode = await exec.exec(rcodesign, args, {
|
|
||||||
silent: true,
|
|
||||||
ignoreReturnCode: true,
|
|
||||||
listeners: {
|
|
||||||
stdout: data => {
|
|
||||||
stdout += data.toString()
|
|
||||||
},
|
|
||||||
stderr: data => {
|
|
||||||
stderr += data.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return { exitCode, stdout, stderr }
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getRcodesign(version) {
|
async function getRcodesign(version) {
|
||||||
const platform = os.platform()
|
const platform = os.platform()
|
||||||
const arch = os.arch()
|
const arch = os.arch()
|
||||||
@@ -27701,29 +27658,10 @@ async function getRcodesign(version) {
|
|||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
const inputPathRaw = core.getInput('input_path', { required: true })
|
const inputPath = core.getInput('input_path', { required: true })
|
||||||
let inputPaths = core.getMultilineInput('input_path')
|
|
||||||
if (inputPaths.length === 1 && inputPaths[0].includes('\n')) {
|
|
||||||
inputPaths = inputPaths[0]
|
|
||||||
.split(/\r?\n/)
|
|
||||||
.map(line => line.trim())
|
|
||||||
.filter(Boolean)
|
|
||||||
}
|
|
||||||
if (inputPaths.length === 0) {
|
|
||||||
throw new Error('input_path is required')
|
|
||||||
}
|
|
||||||
|
|
||||||
const hasMultipleInputPaths = inputPaths.length > 1
|
|
||||||
const inputPath = inputPaths[0] || inputPathRaw.trim()
|
|
||||||
const outputPath = core.getInput('output_path')
|
const outputPath = core.getInput('output_path')
|
||||||
const sign = core.getBooleanInput('sign')
|
const sign = core.getBooleanInput('sign')
|
||||||
const notarize = core.getBooleanInput('notarize')
|
const notarize = core.getBooleanInput('notarize')
|
||||||
const notarizeConcurrencyInput = core.getInput('notarize_concurrency')
|
|
||||||
const notarizeConcurrency = parseInt(notarizeConcurrencyInput || '0', 10)
|
|
||||||
if (Number.isNaN(notarizeConcurrency) || notarizeConcurrency < 0) {
|
|
||||||
throw new Error('notarize_concurrency must be a non-negative integer')
|
|
||||||
}
|
|
||||||
|
|
||||||
const staple = core.getBooleanInput('staple')
|
const staple = core.getBooleanInput('staple')
|
||||||
const configFiles = core.getMultilineInput('config_file')
|
const configFiles = core.getMultilineInput('config_file')
|
||||||
const profile = core.getInput('profile')
|
const profile = core.getInput('profile')
|
||||||
@@ -27748,22 +27686,9 @@ async function run() {
|
|||||||
|
|
||||||
const rcodesign = await getRcodesign(rcodesignVersion)
|
const rcodesign = await getRcodesign(rcodesignVersion)
|
||||||
|
|
||||||
let signedPaths = inputPaths
|
|
||||||
let signedPath = inputPath
|
let signedPath = inputPath
|
||||||
|
|
||||||
if (hasMultipleInputPaths && outputPath) {
|
|
||||||
throw new Error(
|
|
||||||
'output_path cannot be used with multiple input_path values'
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sign) {
|
if (sign) {
|
||||||
if (hasMultipleInputPaths) {
|
|
||||||
throw new Error(
|
|
||||||
'Multiple input_path values are not supported when sign=true'
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
const args = ['sign']
|
const args = ['sign']
|
||||||
|
|
||||||
for (const path of configFiles) {
|
for (const path of configFiles) {
|
||||||
@@ -27808,7 +27733,6 @@ async function run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await exec.exec(rcodesign, args)
|
await exec.exec(rcodesign, args)
|
||||||
signedPaths = [signedPath]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let stapled = false
|
let stapled = false
|
||||||
@@ -27842,64 +27766,9 @@ async function run() {
|
|||||||
args.push('--wait')
|
args.push('--wait')
|
||||||
}
|
}
|
||||||
|
|
||||||
const concurrency =
|
args.push(signedPath)
|
||||||
notarizeConcurrency > 0 ? notarizeConcurrency : signedPaths.length
|
|
||||||
|
|
||||||
core.info(`Submitting ${signedPaths.length} file(s) for notarization`)
|
await exec.exec(rcodesign, args)
|
||||||
|
|
||||||
const results = await mapWithConcurrency(
|
|
||||||
signedPaths,
|
|
||||||
concurrency,
|
|
||||||
async path => {
|
|
||||||
core.info(`Starting notarization: ${path}`)
|
|
||||||
|
|
||||||
const { exitCode, stdout, stderr } = await execRcodesign(rcodesign, [
|
|
||||||
...args,
|
|
||||||
path
|
|
||||||
])
|
|
||||||
|
|
||||||
if (exitCode === 0) {
|
|
||||||
return { path, ok: true, stdout, stderr }
|
|
||||||
}
|
|
||||||
|
|
||||||
return { path, ok: false, exitCode, stdout, stderr }
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
const failures = results.filter(r => !r.ok)
|
|
||||||
for (const result of results) {
|
|
||||||
core.startGroup(
|
|
||||||
result.ok
|
|
||||||
? `notary-submit: ${result.path}`
|
|
||||||
: `notary-submit failed: ${result.path}`
|
|
||||||
)
|
|
||||||
|
|
||||||
if (!result.ok) {
|
|
||||||
core.error(`exit code: ${result.exitCode}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result.stdout.trim()) {
|
|
||||||
if (result.ok) {
|
|
||||||
core.info(result.stdout.trim())
|
|
||||||
} else {
|
|
||||||
core.error(result.stdout.trim())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (result.stderr.trim()) {
|
|
||||||
if (result.ok) {
|
|
||||||
core.info(result.stderr.trim())
|
|
||||||
} else {
|
|
||||||
core.error(result.stderr.trim())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
core.endGroup()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (failures.length > 0) {
|
|
||||||
throw new Error(
|
|
||||||
`Notarization failed for: ${failures.map(f => f.path).join(', ')}`
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (staple) {
|
if (staple) {
|
||||||
stapled = true
|
stapled = true
|
||||||
@@ -27913,64 +27782,12 @@ async function run() {
|
|||||||
args.push('--config-file', path)
|
args.push('--config-file', path)
|
||||||
}
|
}
|
||||||
|
|
||||||
const concurrency =
|
args.push(signedPath)
|
||||||
notarizeConcurrency > 0 ? notarizeConcurrency : signedPaths.length
|
|
||||||
|
|
||||||
const results = await mapWithConcurrency(
|
await exec.exec(rcodesign, args)
|
||||||
signedPaths,
|
|
||||||
concurrency,
|
|
||||||
async path => {
|
|
||||||
core.info(`Stapling notarization ticket: ${path}`)
|
|
||||||
|
|
||||||
const { exitCode, stdout, stderr } = await execRcodesign(rcodesign, [
|
|
||||||
...args,
|
|
||||||
path
|
|
||||||
])
|
|
||||||
|
|
||||||
if (exitCode === 0) {
|
|
||||||
return { path, ok: true, stdout, stderr }
|
|
||||||
}
|
|
||||||
|
|
||||||
return { path, ok: false, exitCode, stdout, stderr }
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
const failures = results.filter(r => !r.ok)
|
|
||||||
for (const result of results) {
|
|
||||||
core.startGroup(
|
|
||||||
result.ok ? `staple: ${result.path}` : `staple failed: ${result.path}`
|
|
||||||
)
|
|
||||||
|
|
||||||
if (!result.ok) {
|
|
||||||
core.error(`exit code: ${result.exitCode}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result.stdout.trim()) {
|
|
||||||
if (result.ok) {
|
|
||||||
core.info(result.stdout.trim())
|
|
||||||
} else {
|
|
||||||
core.error(result.stdout.trim())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (result.stderr.trim()) {
|
|
||||||
if (result.ok) {
|
|
||||||
core.info(result.stderr.trim())
|
|
||||||
} else {
|
|
||||||
core.error(result.stderr.trim())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
core.endGroup()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (failures.length > 0) {
|
|
||||||
throw new Error(
|
|
||||||
`Stapling failed for: ${failures.map(f => f.path).join(', ')}`
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
core.setOutput('output_path', signedPaths[0])
|
core.setOutput('output_path', signedPath)
|
||||||
core.setOutput('output_paths', signedPaths.join('\n'))
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message)
|
core.setFailed(error.message)
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-189
@@ -3,49 +3,6 @@ const exec = require('@actions/exec')
|
|||||||
const toolCache = require('@actions/tool-cache')
|
const toolCache = require('@actions/tool-cache')
|
||||||
const os = require('os')
|
const os = require('os')
|
||||||
|
|
||||||
async function mapWithConcurrency(items, concurrency, fn) {
|
|
||||||
if (!Number.isInteger(concurrency) || concurrency < 1) {
|
|
||||||
throw new Error('concurrency must be a positive integer')
|
|
||||||
}
|
|
||||||
|
|
||||||
const results = new Array(items.length)
|
|
||||||
let nextIndex = 0
|
|
||||||
|
|
||||||
async function worker() {
|
|
||||||
for (let index = nextIndex++; index < items.length; index = nextIndex++) {
|
|
||||||
results[index] = await fn(items[index], index)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const workers = Array.from(
|
|
||||||
{ length: Math.min(concurrency, items.length) },
|
|
||||||
() => worker()
|
|
||||||
)
|
|
||||||
await Promise.all(workers)
|
|
||||||
|
|
||||||
return results
|
|
||||||
}
|
|
||||||
|
|
||||||
async function execRcodesign(rcodesign, args) {
|
|
||||||
let stdout = ''
|
|
||||||
let stderr = ''
|
|
||||||
|
|
||||||
const exitCode = await exec.exec(rcodesign, args, {
|
|
||||||
silent: true,
|
|
||||||
ignoreReturnCode: true,
|
|
||||||
listeners: {
|
|
||||||
stdout: data => {
|
|
||||||
stdout += data.toString()
|
|
||||||
},
|
|
||||||
stderr: data => {
|
|
||||||
stderr += data.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return { exitCode, stdout, stderr }
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getRcodesign(version) {
|
async function getRcodesign(version) {
|
||||||
const platform = os.platform()
|
const platform = os.platform()
|
||||||
const arch = os.arch()
|
const arch = os.arch()
|
||||||
@@ -111,29 +68,10 @@ async function getRcodesign(version) {
|
|||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
const inputPathRaw = core.getInput('input_path', { required: true })
|
const inputPath = core.getInput('input_path', { required: true })
|
||||||
let inputPaths = core.getMultilineInput('input_path')
|
|
||||||
if (inputPaths.length === 1 && inputPaths[0].includes('\n')) {
|
|
||||||
inputPaths = inputPaths[0]
|
|
||||||
.split(/\r?\n/)
|
|
||||||
.map(line => line.trim())
|
|
||||||
.filter(Boolean)
|
|
||||||
}
|
|
||||||
if (inputPaths.length === 0) {
|
|
||||||
throw new Error('input_path is required')
|
|
||||||
}
|
|
||||||
|
|
||||||
const hasMultipleInputPaths = inputPaths.length > 1
|
|
||||||
const inputPath = inputPaths[0] || inputPathRaw.trim()
|
|
||||||
const outputPath = core.getInput('output_path')
|
const outputPath = core.getInput('output_path')
|
||||||
const sign = core.getBooleanInput('sign')
|
const sign = core.getBooleanInput('sign')
|
||||||
const notarize = core.getBooleanInput('notarize')
|
const notarize = core.getBooleanInput('notarize')
|
||||||
const notarizeConcurrencyInput = core.getInput('notarize_concurrency')
|
|
||||||
const notarizeConcurrency = parseInt(notarizeConcurrencyInput || '0', 10)
|
|
||||||
if (Number.isNaN(notarizeConcurrency) || notarizeConcurrency < 0) {
|
|
||||||
throw new Error('notarize_concurrency must be a non-negative integer')
|
|
||||||
}
|
|
||||||
|
|
||||||
const staple = core.getBooleanInput('staple')
|
const staple = core.getBooleanInput('staple')
|
||||||
const configFiles = core.getMultilineInput('config_file')
|
const configFiles = core.getMultilineInput('config_file')
|
||||||
const profile = core.getInput('profile')
|
const profile = core.getInput('profile')
|
||||||
@@ -158,22 +96,9 @@ async function run() {
|
|||||||
|
|
||||||
const rcodesign = await getRcodesign(rcodesignVersion)
|
const rcodesign = await getRcodesign(rcodesignVersion)
|
||||||
|
|
||||||
let signedPaths = inputPaths
|
|
||||||
let signedPath = inputPath
|
let signedPath = inputPath
|
||||||
|
|
||||||
if (hasMultipleInputPaths && outputPath) {
|
|
||||||
throw new Error(
|
|
||||||
'output_path cannot be used with multiple input_path values'
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sign) {
|
if (sign) {
|
||||||
if (hasMultipleInputPaths) {
|
|
||||||
throw new Error(
|
|
||||||
'Multiple input_path values are not supported when sign=true'
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
const args = ['sign']
|
const args = ['sign']
|
||||||
|
|
||||||
for (const path of configFiles) {
|
for (const path of configFiles) {
|
||||||
@@ -218,7 +143,6 @@ async function run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await exec.exec(rcodesign, args)
|
await exec.exec(rcodesign, args)
|
||||||
signedPaths = [signedPath]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let stapled = false
|
let stapled = false
|
||||||
@@ -252,64 +176,9 @@ async function run() {
|
|||||||
args.push('--wait')
|
args.push('--wait')
|
||||||
}
|
}
|
||||||
|
|
||||||
const concurrency =
|
args.push(signedPath)
|
||||||
notarizeConcurrency > 0 ? notarizeConcurrency : signedPaths.length
|
|
||||||
|
|
||||||
core.info(`Submitting ${signedPaths.length} file(s) for notarization`)
|
await exec.exec(rcodesign, args)
|
||||||
|
|
||||||
const results = await mapWithConcurrency(
|
|
||||||
signedPaths,
|
|
||||||
concurrency,
|
|
||||||
async path => {
|
|
||||||
core.info(`Starting notarization: ${path}`)
|
|
||||||
|
|
||||||
const { exitCode, stdout, stderr } = await execRcodesign(rcodesign, [
|
|
||||||
...args,
|
|
||||||
path
|
|
||||||
])
|
|
||||||
|
|
||||||
if (exitCode === 0) {
|
|
||||||
return { path, ok: true, stdout, stderr }
|
|
||||||
}
|
|
||||||
|
|
||||||
return { path, ok: false, exitCode, stdout, stderr }
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
const failures = results.filter(r => !r.ok)
|
|
||||||
for (const result of results) {
|
|
||||||
core.startGroup(
|
|
||||||
result.ok
|
|
||||||
? `notary-submit: ${result.path}`
|
|
||||||
: `notary-submit failed: ${result.path}`
|
|
||||||
)
|
|
||||||
|
|
||||||
if (!result.ok) {
|
|
||||||
core.error(`exit code: ${result.exitCode}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result.stdout.trim()) {
|
|
||||||
if (result.ok) {
|
|
||||||
core.info(result.stdout.trim())
|
|
||||||
} else {
|
|
||||||
core.error(result.stdout.trim())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (result.stderr.trim()) {
|
|
||||||
if (result.ok) {
|
|
||||||
core.info(result.stderr.trim())
|
|
||||||
} else {
|
|
||||||
core.error(result.stderr.trim())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
core.endGroup()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (failures.length > 0) {
|
|
||||||
throw new Error(
|
|
||||||
`Notarization failed for: ${failures.map(f => f.path).join(', ')}`
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (staple) {
|
if (staple) {
|
||||||
stapled = true
|
stapled = true
|
||||||
@@ -323,64 +192,12 @@ async function run() {
|
|||||||
args.push('--config-file', path)
|
args.push('--config-file', path)
|
||||||
}
|
}
|
||||||
|
|
||||||
const concurrency =
|
args.push(signedPath)
|
||||||
notarizeConcurrency > 0 ? notarizeConcurrency : signedPaths.length
|
|
||||||
|
|
||||||
const results = await mapWithConcurrency(
|
await exec.exec(rcodesign, args)
|
||||||
signedPaths,
|
|
||||||
concurrency,
|
|
||||||
async path => {
|
|
||||||
core.info(`Stapling notarization ticket: ${path}`)
|
|
||||||
|
|
||||||
const { exitCode, stdout, stderr } = await execRcodesign(rcodesign, [
|
|
||||||
...args,
|
|
||||||
path
|
|
||||||
])
|
|
||||||
|
|
||||||
if (exitCode === 0) {
|
|
||||||
return { path, ok: true, stdout, stderr }
|
|
||||||
}
|
|
||||||
|
|
||||||
return { path, ok: false, exitCode, stdout, stderr }
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
const failures = results.filter(r => !r.ok)
|
|
||||||
for (const result of results) {
|
|
||||||
core.startGroup(
|
|
||||||
result.ok ? `staple: ${result.path}` : `staple failed: ${result.path}`
|
|
||||||
)
|
|
||||||
|
|
||||||
if (!result.ok) {
|
|
||||||
core.error(`exit code: ${result.exitCode}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result.stdout.trim()) {
|
|
||||||
if (result.ok) {
|
|
||||||
core.info(result.stdout.trim())
|
|
||||||
} else {
|
|
||||||
core.error(result.stdout.trim())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (result.stderr.trim()) {
|
|
||||||
if (result.ok) {
|
|
||||||
core.info(result.stderr.trim())
|
|
||||||
} else {
|
|
||||||
core.error(result.stderr.trim())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
core.endGroup()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (failures.length > 0) {
|
|
||||||
throw new Error(
|
|
||||||
`Stapling failed for: ${failures.map(f => f.path).join(', ')}`
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
core.setOutput('output_path', signedPaths[0])
|
core.setOutput('output_path', signedPath)
|
||||||
core.setOutput('output_paths', signedPaths.join('\n'))
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message)
|
core.setFailed(error.message)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user