Skip to content

Commit cd5d067

Browse files
committed
fix: unblock release packaging
1 parent 0c38772 commit cd5d067

2 files changed

Lines changed: 20 additions & 5 deletions

File tree

.github/workflows/candidate.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ jobs:
5858
awk -v heading="## [$version]" 'index($0, heading) == 1 {found=1; next} found && /^## \[/ {exit} found {print}' CHANGELOG.md
5959
} >"$notes"
6060
if gh release view "$tag" --repo "$GITHUB_REPOSITORY" --json isDraft,targetCommitish >existing.json 2>/dev/null; then
61-
EXISTING_JSON=existing.json COMMIT="$COMMIT" node -e \
62-
'const r=JSON.parse(require("node:fs").readFileSync(process.env.EXISTING_JSON,"utf8")); if(!r.isDraft||![process.env.COMMIT,"main"].includes(r.targetCommitish)) throw new Error("an existing release or unrelated draft already owns this version")'
61+
EXISTING_JSON=existing.json node -e \
62+
'const r=JSON.parse(require("node:fs").readFileSync(process.env.EXISTING_JSON,"utf8")); if(!r.isDraft) throw new Error("an existing published release already owns this version")'
6363
gh release edit "$tag" --repo "$GITHUB_REPOSITORY" --target "$COMMIT" \
6464
--title "1Helm $version" --notes-file "$notes"
6565
gh release delete-asset "$tag" "1Helm-$version-stable.json" \
@@ -102,7 +102,7 @@ jobs:
102102
npm run package:linux
103103
archive="dist/1Helm-$VERSION-linux-node.tgz"
104104
test -s "$archive"
105-
tar -tzf "$archive" | grep -m1 '^1Helm-[^/]*/container/channel-machine\.oci\.tar$' >/dev/null
105+
tar -tzf "$archive" | grep '^1Helm-[^/]*/container/channel-machine\.oci\.tar$' >/dev/null
106106
gh release upload "$TAG" "$archive" --repo "$GITHUB_REPOSITORY" --clobber
107107
if gh release view "$TAG" --repo "$GITHUB_REPOSITORY" --json assets \
108108
--jq ".assets[] | select(.name == \"$(basename "$archive")\") | .digest" | grep -q '^sha256:[a-f0-9]\{64\}$'; then

scripts/package-mac-dmg.cjs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,22 @@ function notarize(file) {
7979
run("xcrun", ["notarytool", "submit", file, "--keychain-profile", NOTARY_PROFILE, "--wait"]);
8080
}
8181

82+
async function signWithTimestampRetry(options) {
83+
const { sign } = require("@electron/osx-sign");
84+
for (let attempt = 1; attempt <= 3; attempt += 1) {
85+
try {
86+
await sign(options);
87+
return;
88+
} catch (error) {
89+
const message = String(error?.stack || error?.message || error);
90+
const transient = /timestamp was expected but was not found|timestamp service is not available/i.test(message);
91+
if (!transient || attempt === 3) throw error;
92+
console.warn(`Apple timestamp service failed transiently; retrying signature (${attempt}/3).`);
93+
await new Promise((resolveDelay) => setTimeout(resolveDelay, attempt * 5_000));
94+
}
95+
}
96+
}
97+
8298
function createIcon() {
8399
const source = MACOS_APP_ICON_SOURCE;
84100
if (!fs.existsSync(source)) throw new Error("desktop/icons/1helm-macos-app-logo.jpg is required");
@@ -228,8 +244,7 @@ async function main() {
228244

229245
if (identity) {
230246
console.log("Signing 1Helm with the matching Developer ID Application identity.");
231-
const { sign } = require("@electron/osx-sign");
232-
await sign({ app: appPath, identity: identity.hash, platform: "darwin" });
247+
await signWithTimestampRetry({ app: appPath, identity: identity.hash, platform: "darwin" });
233248
} else {
234249
console.log("Signing an ad-hoc local build (not for distribution)." );
235250
run("codesign", ["--force", "--deep", "--sign", "-", appPath]);

0 commit comments

Comments
 (0)