fix: encode Xcode archive creation date
This commit is contained in:
parent
b3f5e8242a
commit
7619036c6f
2 changed files with 13 additions and 1 deletions
|
|
@ -234,6 +234,13 @@ function localDateDirectory() {
|
||||||
return `${date.getFullYear()}-${part(date.getMonth() + 1)}-${part(date.getDate())}`
|
return `${date.getFullYear()}-${part(date.getMonth() + 1)}-${part(date.getDate())}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function formatPlistDate(date) {
|
||||||
|
const weekdays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
|
||||||
|
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
|
||||||
|
const part = (value) => String(value).padStart(2, '0')
|
||||||
|
return `${weekdays[date.getUTCDay()]} ${months[date.getUTCMonth()]} ${part(date.getUTCDate())} ${part(date.getUTCHours())}:${part(date.getUTCMinutes())}:${part(date.getUTCSeconds())} ${date.getUTCFullYear()}`
|
||||||
|
}
|
||||||
|
|
||||||
function createXcodeArchive(application, input) {
|
function createXcodeArchive(application, input) {
|
||||||
const archive = path.join(
|
const archive = path.join(
|
||||||
os.homedir(),
|
os.homedir(),
|
||||||
|
|
@ -249,7 +256,7 @@ function createXcodeArchive(application, input) {
|
||||||
run('/usr/bin/plutil', ['-create', 'xml1', info])
|
run('/usr/bin/plutil', ['-create', 'xml1', info])
|
||||||
const add = (key, type, value) => run('/usr/libexec/PlistBuddy', ['-c', `Add :${key} ${type} ${value}`, info])
|
const add = (key, type, value) => run('/usr/libexec/PlistBuddy', ['-c', `Add :${key} ${type} ${value}`, info])
|
||||||
add('ArchiveVersion', 'integer', '2')
|
add('ArchiveVersion', 'integer', '2')
|
||||||
add('CreationDate', 'date', new Date().toISOString())
|
add('CreationDate', 'date', formatPlistDate(new Date()))
|
||||||
add('Name', 'string', `HoloLake ${input.version} ${input.sourceCommit.slice(0, 12)}`)
|
add('Name', 'string', `HoloLake ${input.version} ${input.sourceCommit.slice(0, 12)}`)
|
||||||
add('SchemeName', 'string', 'HoloLake')
|
add('SchemeName', 'string', 'HoloLake')
|
||||||
add('HoloLakeSourceCommit', 'string', input.sourceCommit)
|
add('HoloLakeSourceCommit', 'string', input.sourceCommit)
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import { readFileSync } from 'node:fs'
|
||||||
import test from 'node:test'
|
import test from 'node:test'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
formatPlistDate,
|
||||||
materializeUpdaterPrivateKey,
|
materializeUpdaterPrivateKey,
|
||||||
validateCredentialEnvironment,
|
validateCredentialEnvironment,
|
||||||
validateReleaseInput,
|
validateReleaseInput,
|
||||||
|
|
@ -39,6 +40,10 @@ const readyInput = () => ({
|
||||||
restartMessage: 'Restart manually',
|
restartMessage: 'Restart manually',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('Xcode archive creation uses the plist date format accepted by PlistBuddy', () => {
|
||||||
|
assert.equal(formatPlistDate(new Date('2026-08-19T01:02:03Z')), 'Wed Aug 19 01:02:03 2026')
|
||||||
|
})
|
||||||
|
|
||||||
test('release pipeline refuses an unprovisioned or upstream-owned trust document', () => {
|
test('release pipeline refuses an unprovisioned or upstream-owned trust document', () => {
|
||||||
const unprovisioned = readyTrust()
|
const unprovisioned = readyTrust()
|
||||||
unprovisioned.state = 'UNPROVISIONED_FAIL_CLOSED'
|
unprovisioned.state = 'UNPROVISIONED_FAIL_CLOSED'
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue