Skip to content

VoiceStudio is the open-source, fully-local ElevenLabs alternative — voice cloning, voice design, video dubbing, dictation, transcription & audiobook creation in 646 languages.

fix(release): build again when Apple's ticket server drops the macOS staple

velixio3ee0963fd891
diff --git a/.github/workflows/electron-release.yml b/.github/workflows/electron-release.yml
index f24b2dea8..0f84965dc 100644
--- a/.github/workflows/electron-release.yml
+++ b/.github/workflows/electron-release.yml
@@ -199,7 +199,15 @@ jobs:
# Discovery is limited to that imported keychain, not the runner's.
export CSC_IDENTITY_AUTO_DISCOVERY=true
fi
- bun x electron-builder --config electron-builder.config.mjs ${{ matrix.flags }} --publish never
+ # Apple's ticket server can drop the staple lookup after notarization
+ # succeeded (error 68, v0.5.7-beta.2); only that failure builds again.
+ set -o pipefail
+ attempt=1
+ until bun x electron-builder --config electron-builder.config.mjs ${{ matrix.flags }} --publish never 2>&1 | tee "$RUNNER_TEMP/electron-builder.log"; do
+ if [ "$attempt" -ge 2 ] || ! grep -q "Failed to staple" "$RUNNER_TEMP/electron-builder.log"; then exit 1; fi
+ attempt=$((attempt + 1))
+ echo "::warning::Stapling the notarization ticket failed; building again"
+ done
if [ "$RUNNER_OS" = Linux ]; then
node scripts/embed-appimage-update.mjs
fi
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5f14ced53..fdbff65b2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -105,6 +105,7 @@ metadata and the backend fallback mirror it.
### CI
+- macOS release builds retry once when Apple's ticket server drops the notarization staple, instead of failing the whole release (#3244)
- Release notes list everyone who contributed since the last stable release automatically, instead of only the people thanked by hand (#3242)
- Release notes list each platform's installer signing as measured on the build, and a macOS build that would open as "damaged" can no longer be released, and macOS releases are signed with the Developer ID again (#3241, #3243)
- The owner can let named maintainers publish releases while Windows installers are still unsigned (#3236)
diff --git a/tests/test_electron_transition.py b/tests/test_electron_transition.py
index 4e537dc96..b668432b4 100644
--- a/tests/test_electron_transition.py
+++ b/tests/test_electron_transition.py
@@ -265,7 +265,7 @@ def test_packaging_omits_empty_signing_credentials(tmp_path, credentials, expect
env = {k: v for k, v in os.environ.items() if k not in {'CSC_LINK', 'CSC_KEY_PASSWORD'}}
env.update(credentials)
capture = tmp_path / 'signing-env'
- env.update(PATH=str(tmp_path) + os.pathsep + env['PATH'], CAPTURE_PATH=str(capture))
+ env.update(PATH=str(tmp_path) + os.pathsep + env['PATH'], CAPTURE_PATH=str(capture), RUNNER_TEMP=str(tmp_path))
script = step['run'].replace('${{ matrix.flags }}', '--mac --arm64').replace('${{ matrix.platform }}', 'darwin').replace('${{ matrix.arch }}', 'arm64')
subprocess.run(['bash', '-e', '-c', script], env=env, check=True)
assert capture.read_text() == expected
diff --git a/tests/test_release_signing_notes.py b/tests/test_release_signing_notes.py
index a6120ad57..e6af35c8b 100644
--- a/tests/test_release_signing_notes.py
+++ b/tests/test_release_signing_notes.py
@@ -71,7 +71,7 @@ def test_mac_package_discovers_the_imported_developer_id(tmp_path):
import os
import subprocess
package = next(s for s in load_workflow()["jobs"]["package"]["steps"] if s.get("name") == "Package without publishing")
- script = package["run"].split("bun x electron-builder")[0].replace("${{ matrix.platform }}", "darwin")
+ script = package["run"].split("set -o pipefail")[0].replace("${{ matrix.platform }}", "darwin")
for link, expected in [("base64-p12", "true"), ("", "false")]:
env = dict(os.environ, CSC_LINK=link, CSC_KEY_PASSWORD="x", CSC_IDENTITY_AUTO_DISCOVERY="false", PUBLISH="false")
out = subprocess.run(["bash", "-e", "-c", script + 'echo "$CSC_IDENTITY_AUTO_DISCOVERY"'],
@@ -108,3 +108,30 @@ def test_release_notes_helper_comes_from_the_workflow_commit(tmp_path):
GITHUB_REPOSITORY="debpalash/VoiceStudio", RUNNER_TEMP=str(tmp_path))
subprocess.run(["bash", "-e", "-c", describe["run"]], cwd=work, env=env, check=True)
assert "| Linux x64 |" in (work / "release-assets/RELEASE_NOTES.md").read_text()
+
+
[email protected]("failures,message,calls,ok", [
+ (1, "Failed to staple your application with code: 68", 2, True),
+ (2, "Failed to staple your application with code: 68", 2, False),
+ (1, "codesign failed", 1, False),
+])
+def test_package_builds_again_only_when_stapling_fails(tmp_path, failures, message, calls, ok):
+ # A dropped connection to Apple's ticket server failed beta.2 after notarization.
+ import os
+ import subprocess
+ package = next(s for s in load_workflow()["jobs"]["package"]["steps"] if s.get("name") == "Package without publishing")
+ script = package["run"].split('if [ "$RUNNER_OS" = Linux ]')[0]
+ script = script.replace("${{ matrix.platform }}", "darwin").replace("${{ matrix.flags }}", "--mac")
+ fake = tmp_path / "bin"
+ fake.mkdir()
+ count = tmp_path / "calls"
+ (fake / "bun").write_text(
+ f'#!/bin/sh\necho x >> "{count}"\n'
+ f'[ "$(wc -l < "{count}")" -gt {failures} ] && exit 0\necho "{message}"; exit 1\n'
+ )
+ (fake / "bun").chmod(0o755)
+ env = dict(os.environ, PATH=f"{fake}{os.pathsep}{os.environ['PATH']}", RUNNER_TEMP=str(tmp_path),
+ CSC_LINK="", PUBLISH="false")
+ result = subprocess.run(["bash", "-e", "-c", script], env=env, capture_output=True, text=True)
+ assert (result.returncode == 0) is ok, result.stdout + result.stderr
+ assert len(count.read_text().splitlines()) == calls