create-disposabl-app 0.14.18 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/disposabl.js CHANGED
@@ -5,7 +5,7 @@ import { lock } from "proper-lockfile";
5
5
  // ../cli/package.json
6
6
  var package_default = {
7
7
  name: "@disposabl/cli",
8
- version: "0.14.18",
8
+ version: "0.15.0",
9
9
  type: "module",
10
10
  description: "Command-line access to your Disposabl app",
11
11
  license: "MIT",
package/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
8
8
  import { Command, CommanderError } from "commander";
9
9
  import * as p2 from "@clack/prompts";
10
10
  // package.json
11
- var version = "0.14.18";
11
+ var version = "0.15.0";
12
12
 
13
13
  // ../disposabl-kit/platforms.ts
14
14
  var platforms = [
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ set +x
4
+
5
+ clean_directory() {
6
+ local directory=$1
7
+ [[ "${directory%/*}" == "${RUNNER_TEMP:?}" && "${directory##*/}" == macos-signing.???????? && ! -L "$directory" ]] || return 1
8
+ security delete-keychain "$directory/signing.keychain-db" >/dev/null 2>&1 || true
9
+ rm -f -- "$directory/certificate.p12" "$directory/AuthKey.p8"
10
+ if [[ -d "$directory/mount" ]]; then
11
+ # Never recursively remove a volume that could not be detached.
12
+ hdiutil detach "$directory/mount" >/dev/null 2>&1 || rmdir "$directory/mount" || return 1
13
+ fi
14
+ rm -rf -- "$directory"
15
+ }
16
+
17
+ if [[ "${1:-}" == cleanup ]]; then
18
+ [[ -z "${MACOS_SIGNING_DIRECTORY:-}" ]] || clean_directory "$MACOS_SIGNING_DIRECTORY"
19
+ exit
20
+ fi
21
+
22
+ # This wrapper owns the credentials for the build and removes them on every exit.
23
+ if [[ -z "${MACOS_SIGNING_CONFIG:-}" ]]; then
24
+ export MACOS_NOTARIZE=false
25
+ bun run --cwd apps/desktop preview
26
+ exit
27
+ fi
28
+
29
+ for field in certificateBase64 certificatePassword identity teamId apiKeyBase64 apiKeyId apiIssuer; do
30
+ jq -e --arg field "$field" '.[$field] | type == "string" and length > 0 and (contains("\n") | not) and (contains("\r") | not)' <<< "$MACOS_SIGNING_CONFIG" >/dev/null || { echo "Invalid macOS signing configuration: $field" >&2; exit 1; }
31
+ done
32
+ identity=$(jq -r .identity <<< "$MACOS_SIGNING_CONFIG")
33
+ team=$(jq -r .teamId <<< "$MACOS_SIGNING_CONFIG")
34
+ [[ "$team" =~ ^[A-Z0-9]{10}$ && "$identity" == "Developer ID Application: "*" ($team)" ]] || { echo 'Expected a Developer ID Application identity and team ID' >&2; exit 1; }
35
+ temp=$(mktemp -d "${RUNNER_TEMP:?}/macos-signing.XXXXXXXX")
36
+ keychain="$temp/signing.keychain-db"
37
+ cleanup() { local status=$?; clean_directory "$temp" || status=1; exit "$status"; }
38
+ trap cleanup EXIT
39
+ trap 'exit 1' HUP INT TERM
40
+ printf 'MACOS_SIGNING_DIRECTORY=%s\n' "$temp" >> "${GITHUB_ENV:?}"
41
+ umask 077
42
+ jq -r .certificateBase64 <<< "$MACOS_SIGNING_CONFIG" | base64 -D > "$temp/certificate.p12"
43
+ jq -r .apiKeyBase64 <<< "$MACOS_SIGNING_CONFIG" | base64 -D > "$temp/AuthKey.p8"
44
+ password=$(openssl rand -hex 32)
45
+ security create-keychain -p "$password" "$keychain"
46
+ security set-keychain-settings -lut 1800 "$keychain"
47
+ security unlock-keychain -p "$password" "$keychain"
48
+ security import "$temp/certificate.p12" -k "$keychain" -P "$(jq -r .certificatePassword <<< "$MACOS_SIGNING_CONFIG")" -T /usr/bin/codesign
49
+ security set-key-partition-list -S apple-tool:,apple: -s -k "$password" "$keychain" >/dev/null
50
+ export MACOS_NOTARIZE=true MACOS_KEYCHAIN="$keychain" MACOS_SIGNING_IDENTITY="$identity"
51
+ export APPLE_API_KEY="$temp/AuthKey.p8" APPLE_API_KEY_ID="$(jq -r .apiKeyId <<< "$MACOS_SIGNING_CONFIG")" APPLE_API_ISSUER="$(jq -r .apiIssuer <<< "$MACOS_SIGNING_CONFIG")"
52
+ unset MACOS_SIGNING_CONFIG password
53
+ bun run --cwd apps/desktop preview
54
+ shopt -s nullglob
55
+ zips=(dist/release/*.zip)
56
+ dmgs=(dist/release/*.dmg)
57
+ [[ ${#zips[@]} == 1 && ${#dmgs[@]} == 1 ]] || { echo 'Expected one macOS update ZIP and DMG' >&2; exit 1; }
58
+ mkdir "$temp/verify"
59
+ ditto -x -k "${zips[0]}" "$temp/verify"
60
+ apps=("$temp"/verify/*.app)
61
+ [[ ${#apps[@]} == 1 ]] || { echo 'Expected one app in the update ZIP' >&2; exit 1; }
62
+ verify_app() {
63
+ local details
64
+ codesign --verify --deep --strict --verbose=2 "$1" >&2 || return 1
65
+ details=$(codesign -dv --verbose=4 "$1" 2>&1) || return 1
66
+ grep -Fx "Authority=$identity" <<< "$details" >/dev/null || return 1
67
+ grep -Fx "TeamIdentifier=$team" <<< "$details" >/dev/null || return 1
68
+ xcrun stapler validate "$1" >&2 || return 1
69
+ spctl --assess --type execute --verbose=2 "$1" >&2 || return 1
70
+ grep -E '^CDHash=[a-f0-9]+$' <<< "$details"
71
+ }
72
+ zip_hash=$(verify_app "${apps[0]}")
73
+ mkdir "$temp/mount"
74
+ hdiutil attach -readonly -nobrowse -mountpoint "$temp/mount" "${dmgs[0]}" >/dev/null
75
+ apps=("$temp"/mount/*.app)
76
+ [[ ${#apps[@]} == 1 ]] || { echo 'Expected one app in the DMG' >&2; exit 1; }
77
+ dmg_hash=$(verify_app "${apps[0]}")
78
+ [[ "$dmg_hash" == "$zip_hash" ]] || { echo 'DMG and update ZIP contain different apps' >&2; exit 1; }
79
+ hdiutil detach "$temp/mount" >/dev/null
80
+ [[ ! -d "$temp/mount" ]] || rmdir "$temp/mount"
81
+ echo 'MACOS_NOTARIZE=true' >> "${GITHUB_ENV:?}"
@@ -43,7 +43,7 @@ node --input-type=module -e '
43
43
  const mobile = /^(apps\/mobile\/|packages\/disposabl-kit\/|\.github\/scripts\/(mobile|apple|android-runner)\.sh$)/;
44
44
  for (const platform of ["android", "ios"]) console.log(`${platform}=${(platform === "ios" ? process.env.IOS_BUILDS_ENABLED !== "false" : process.env.EXPO_CONNECTED === "true") && affected(platform, mobile)}`);
45
45
  const production = process.env.GITHUB_EVENT_NAME === "push" && process.env.GITHUB_REF === "refs/heads/main";
46
- const desktop = (production ? ["linux", "windows", "macos"] : []).filter(platform => affected(platform, /^apps\/desktop\//))
46
+ const desktop = (production ? ["linux", "windows", "macos"] : []).filter(platform => affected(platform, platform === "macos" ? /^(apps\/desktop\/|\.github\/scripts\/macos-release\.sh$)/ : /^apps\/desktop\//))
47
47
  .map(platform => ({platform, runner: runners[platform]}));
48
48
  console.log(`desktop=${JSON.stringify(desktop)}`);
49
49
  const packages = (production ? ["cli", "sdk"] : []).filter(name => {
@@ -44,7 +44,7 @@ check_source() {
44
44
  else test "$(gh api "repos/$GH_REPO/pulls/$PR" --jq 'if .state == "open" then .head.sha else "closed" end')" = "$SOURCE"; fi
45
45
  }
46
46
  # Desktop installers publish only from main. Android retains PR previews.
47
- for platform in android linux windows; do
47
+ for platform in android linux windows macos; do
48
48
  [[ "$platform" == android || "$CHANNEL" == production ]] || continue
49
49
  directory="artifacts/release-$platform"
50
50
  test -d "$directory" || continue
@@ -403,7 +403,14 @@ jobs:
403
403
  echo "DISPOSABL_DESKTOP_ID=$id" >> "$GITHUB_ENV"
404
404
  echo "DISPOSABL_DESKTOP_UPDATE_URL=${CONVEX_SITE_URL}/desktop/updates/$id" >> "$GITHUB_ENV"
405
405
  - name: Build
406
+ if: matrix.platform != 'macos'
406
407
  run: bun run --cwd apps/desktop preview
408
+ - name: Build macOS
409
+ if: matrix.platform == 'macos'
410
+ shell: bash
411
+ env:
412
+ MACOS_SIGNING_CONFIG: ${{ secrets.MACOS_SIGNING_CONFIG }}
413
+ run: bash .github/scripts/macos-release.sh
407
414
  - *publish
408
415
  - name: Publish desktop update feed
409
416
  if: matrix.platform == 'windows' || (matrix.platform == 'macos' && env.MACOS_NOTARIZE == 'true')
@@ -414,7 +421,7 @@ jobs:
414
421
  test "$(gh api "repos/$GH_REPO/git/ref/heads/main" --jq .object.sha)" = "$SOURCE"
415
422
  node apps/desktop/publish-update.mjs
416
423
  - name: Upload desktop release artifacts
417
- if: matrix.platform != 'macos'
424
+ if: matrix.platform != 'macos' || env.MACOS_NOTARIZE == 'true'
418
425
  uses: actions/upload-artifact@v4
419
426
  with:
420
427
  name: release-${{ env.PLATFORM }}
@@ -431,7 +438,7 @@ jobs:
431
438
  retention-days: 3
432
439
  if-no-files-found: error
433
440
  - name: Upload unsigned macOS artifact
434
- if: matrix.platform == 'macos'
441
+ if: matrix.platform == 'macos' && env.MACOS_NOTARIZE != 'true'
435
442
  uses: actions/upload-artifact@v4
436
443
  with:
437
444
  name: macos-unsigned
@@ -442,13 +449,17 @@ jobs:
442
449
  compression-level: 0
443
450
  if-no-files-found: error
444
451
  - name: Report macOS artifact
445
- if: matrix.platform == 'macos'
452
+ if: matrix.platform == 'macos' && env.MACOS_NOTARIZE != 'true'
446
453
  run: |
447
454
  echo 'macOS DMG is ad-hoc signed, not Developer ID signed or notarized. Download it from this workflow run’s artifacts.' >> "$GITHUB_STEP_SUMMARY"
448
455
  node .github/scripts/disposabl.mjs report macos blocked 'Ad-hoc signed DMG available in workflow artifacts; Developer ID signing and notarization are not configured.'
449
456
  - name: Report desktop failure
450
457
  if: failure() || cancelled()
451
458
  run: node .github/scripts/disposabl.mjs report "$PLATFORM" failed
459
+ - name: Clean up macOS signing
460
+ if: always() && matrix.platform == 'macos'
461
+ shell: bash
462
+ run: bash .github/scripts/macos-release.sh cleanup
452
463
  packages:
453
464
  name: Package / ${{ matrix.package }}
454
465
  needs: [changes, web]
@@ -45,7 +45,7 @@ The root [pipeline](../../.github/workflows/pipeline.yml) selects enabled target
45
45
 
46
46
  The build helper temporarily sets version `1.<workflow run number>.<run attempt>`, creates the installers, restores `package.json`, and collects outputs in `dist/release`. Build jobs upload artifacts; the separate publisher checks the source commit and publishes Windows/Linux releases from trusted `main` scripts. Main release tags include the platform and workflow run. Forge itself does not publish.
47
47
 
48
- Windows and Linux installers are unsigned. macOS uses ad hoc signing and provides a DMG as a workflow artifact retained for three days. The pipeline does not currently configure Developer ID signing, notarization, or macOS GitHub releases. The signed macOS update lane still requires separate configuration described below.
48
+ Windows and Linux installers are unsigned. Without signing credentials, macOS uses ad hoc signing and provides a DMG as a workflow artifact retained for three days; updates remain blocked. With the signing configuration below, the production workflow signs, notarizes, verifies and publishes the macOS release and update feed.
49
49
 
50
50
  The desktop window uses `http://localhost:3000` during development and the deployed `CONVEX_SITE_URL` in packaged builds. It shares the website and authentication flow; if the site is unavailable, it shows the bundled starter page.
51
51
 
@@ -65,6 +65,17 @@ Each scaffolded app receives a random persistent `desktopId` in `disposabl.json`
65
65
 
66
66
  After building and verifying Windows artifacts, CI uses the same production `CONVEX_DEPLOY_KEY` already used for backend deployment to upload the full package to Convex file storage and atomically publish its feed record. The website's static-hosting component is not modified. Each release has an immutable versioned filename; existing packages remain in storage so in-flight clients can finish. Feed records are scoped to the app identity, channel, platform and architecture, and reject older workflow runs and attempts. Feed metadata is served without caching; package requests redirect to Convex storage, avoiding the HTTP action response limit. Failed or stale publications leave the previous feed in place. The publisher discards its uploaded blob only if no published feed references it; a lost cleanup response may still require manual storage reconciliation. Storage and egress are billable and retained versions require an explicit future retention policy. Convex upload URLs have a two-minute timeout; a slow or failed upload leaves the prior release available.
67
67
 
68
- macOS also produces a ZIP for Squirrel.Mac. A properly Developer ID signed and notarized build with `MACOS_NOTARIZE=true`, Apple API credentials and a matching signing identity can use the same upload path. Successive releases must retain the same signing identity and bundle identifier. The current CI lane has no signing credentials and creates only ad-hoc signed workflow artifacts, so it deliberately does not publish a macOS update feed. Signature verification remains enabled. Configure signing and notarization before expecting installed macOS updates to work. The existing Linux DEB/RPM artifacts do not configure an apt or RPM repository, so Linux native updates are unavailable until such a repository is provided.
68
+ macOS also produces a ZIP for Squirrel.Mac. To enable signed production releases, set the GitHub Actions secret `MACOS_SIGNING_CONFIG` to a JSON object with these string fields:
69
+
70
+ - `certificateBase64`: base64-encoded `.p12` containing the Developer ID Application certificate and private key.
71
+ - `certificatePassword`: password for that `.p12`.
72
+ - `identity`: the full signing identity, for example `Developer ID Application: Example, Inc. (ABCDE12345)`.
73
+ - `teamId`: the ten-character Apple team ID matching that identity.
74
+ - `apiKeyBase64`: base64-encoded App Store Connect API `.p8` key for notarization.
75
+ - `apiKeyId` and `apiIssuer`: the API key ID and issuer ID.
76
+
77
+ Encode the base64 values on one line. Do not commit this JSON or its source files.
78
+
79
+ The workflow imports the certificate into a temporary keychain, builds and notarizes, then verifies the apps inside both the update ZIP and the read-only mounted DMG, including their signing identity, stapled tickets and Gatekeeper assessment. Their code-directory hashes must match before either is published. A shell trap and an always-run cleanup step remove only that job's keychain and temporary files on normal failures and cancellation; forced termination can prevent cleanup, so self-hosted runners must also clean their temporary directory. Keep the signing identity and bundle identifier stable across releases. A valid Apple Developer ID certificate, notarization access and a macOS runner are required; configuring the secret alone does not prove delivery. The existing Linux DEB/RPM artifacts do not configure an apt or RPM repository, so Linux native updates are unavailable until such a repository is provided.
69
80
 
70
81
  Verify delivery using two installed versions on each supported OS, checking no-update, download, restart, signature rejection and recovery from a failed feed. Building or staging an artifact alone does not prove update delivery. See [Electron's updater documentation](https://www.electronjs.org/docs/latest/api/auto-updater) and [static feed format](https://www.electronjs.org/docs/latest/tutorial/updates).
@@ -31,7 +31,9 @@ if (
31
31
  signedRelease &&
32
32
  (!process.env.APPLE_API_KEY ||
33
33
  !process.env.APPLE_API_KEY_ID ||
34
- !process.env.APPLE_API_ISSUER)
34
+ !process.env.APPLE_API_ISSUER ||
35
+ !process.env.MACOS_SIGNING_IDENTITY ||
36
+ !process.env.MACOS_KEYCHAIN)
35
37
  )
36
38
  throw new Error('macOS releases require Apple notarization credentials');
37
39
 
@@ -51,7 +53,10 @@ const config: ForgeConfig = {
51
53
  ...(process.platform === 'darwin'
52
54
  ? {
53
55
  osxSign: signedRelease
54
- ? {}
56
+ ? {
57
+ identity: process.env.MACOS_SIGNING_IDENTITY!,
58
+ keychain: process.env.MACOS_KEYCHAIN!,
59
+ }
55
60
  : {
56
61
  identity: '-',
57
62
  identityValidation: false,
@@ -91,3 +91,57 @@ test("platform selection keeps iOS optional and sizes Android independently", ()
91
91
  rmSync(dir, { recursive: true, force: true });
92
92
  }
93
93
  });
94
+
95
+ test("a macOS signing-script change selects only the enabled macOS build", () => {
96
+ const dir = mkdtempSync(join(tmpdir(), "disposabl-macos-selection-"));
97
+ try {
98
+ mkdirSync(join(dir, "bin"));
99
+ writeFileSync(join(dir, "bin/gh"), "#!/bin/sh\necho baseline\n", {
100
+ mode: 0o755,
101
+ });
102
+ writeFileSync(
103
+ join(dir, "bin/git"),
104
+ '#!/bin/sh\nif [ "$1" = diff ]; then echo .github/scripts/macos-release.sh; fi\n',
105
+ { mode: 0o755 },
106
+ );
107
+ writeFileSync(
108
+ join(dir, "disposabl.json"),
109
+ JSON.stringify({
110
+ platforms: ["macos", "windows", "linux", "android", "ios"],
111
+ }),
112
+ );
113
+ const out = join(dir, "output");
114
+ execFileSync(
115
+ "bash",
116
+ [resolve(import.meta.dirname, "../../.github/scripts/platforms.sh")],
117
+ {
118
+ cwd: dir,
119
+ env: {
120
+ ...process.env,
121
+ PATH: `${join(dir, "bin")}:${process.env.PATH}`,
122
+ PR: "",
123
+ SOURCE: "current",
124
+ GH_REPO: "fixture/app",
125
+ RUNNER_TEMP: dir,
126
+ GITHUB_OUTPUT: out,
127
+ GITHUB_EVENT_NAME: "push",
128
+ GITHUB_REF: "refs/heads/main",
129
+ EXPO_CONNECTED: "true",
130
+ },
131
+ },
132
+ );
133
+ const selected = Object.fromEntries(
134
+ readFileSync(out, "utf8")
135
+ .trim()
136
+ .split("\n")
137
+ .map((line) => line.split("=")),
138
+ );
139
+ assert.deepEqual(JSON.parse(selected.desktop), [
140
+ { platform: "macos", runner: "macos-26" },
141
+ ]);
142
+ assert.equal(selected.android, "false");
143
+ assert.equal(selected.ios, "false");
144
+ } finally {
145
+ rmSync(dir, { recursive: true, force: true });
146
+ }
147
+ });
@@ -0,0 +1,226 @@
1
+ import { test } from "node:test";
2
+ import assert from "node:assert/strict";
3
+ import {
4
+ mkdtempSync,
5
+ mkdirSync,
6
+ readFileSync,
7
+ readdirSync,
8
+ rmSync,
9
+ writeFileSync,
10
+ } from "node:fs";
11
+ import { tmpdir } from "node:os";
12
+ import { join, resolve } from "node:path";
13
+ import { spawnSync } from "node:child_process";
14
+
15
+ test("macOS signed release verifies before enabling publication and cleans credentials", () => {
16
+ const root = mkdtempSync(join(tmpdir(), "macos-release-test-"));
17
+ try {
18
+ const bin = join(root, "bin");
19
+ mkdirSync(bin);
20
+ mkdirSync(join(root, "dist", "release"), { recursive: true });
21
+ writeFileSync(join(root, "dist", "release", "app.zip"), "fixture");
22
+ writeFileSync(join(root, "dist", "release", "app.dmg"), "fixture");
23
+ const mock = (name: string, body: string) =>
24
+ writeFileSync(join(bin, name), `#!/bin/bash\nset -e\n${body}\n`, {
25
+ mode: 0o755,
26
+ });
27
+ mock("security", 'echo "$1" >> "$CALLS"');
28
+ mock(
29
+ "base64",
30
+ `node -e 'let s="";process.stdin.on("data",d=>s+=d).on("end",()=>process.stdout.write(Buffer.from(s.trim(),"base64")))'`,
31
+ );
32
+ mock("bun", 'echo build >> "$CALLS"');
33
+ mock("ditto", 'mkdir -p "$4/Test.app"');
34
+ mock(
35
+ "hdiutil",
36
+ 'if [[ "$1" == attach ]]; then [[ "${FAIL_STAGE:-}" != attach ]] || exit 1; mkdir -p "$5/Test.app"; else [[ "${FAIL_STAGE:-}" != detach ]] || exit 1; rm -rf "$2/Test.app"; echo detach >> "$CALLS"; fi',
37
+ );
38
+ mock(
39
+ "codesign",
40
+ `target="\${@: -1}"
41
+ if [[ "$1" == "-dv" ]]; then
42
+ hash=abc123
43
+ if [[ "$target" == */mount/* && "\${FAIL_STAGE:-}" == mismatch ]]; then hash=def456; fi
44
+ printf "Authority=Developer ID Application: Test (ABCDE12345)\\nTeamIdentifier=ABCDE12345\\nCDHash=%s\\n" "$hash" >&2
45
+ else
46
+ [[ "\${FAIL_VERIFY:-}" != true ]] || exit 1
47
+ [[ "$target" != */mount/* || "\${FAIL_STAGE:-}" != signature ]] || exit 1
48
+ fi`,
49
+ );
50
+ mock(
51
+ "xcrun",
52
+ 'echo staple >> "$CALLS"; [[ "${@: -1}" != */mount/* || "${FAIL_STAGE:-}" != staple ]]',
53
+ );
54
+ mock(
55
+ "spctl",
56
+ 'echo assess >> "$CALLS"; [[ "${@: -1}" != */mount/* || "${FAIL_STAGE:-}" != assess ]]',
57
+ );
58
+ const config = JSON.stringify({
59
+ certificateBase64: "Y2VydA==",
60
+ certificatePassword: "fixture-password",
61
+ identity: "Developer ID Application: Test (ABCDE12345)",
62
+ teamId: "ABCDE12345",
63
+ apiKeyBase64: "a2V5",
64
+ apiKeyId: "KEY",
65
+ apiIssuer: "ISSUER",
66
+ });
67
+ const script = resolve(
68
+ import.meta.dirname,
69
+ "../../.github/scripts/macos-release.sh",
70
+ );
71
+ const run = (fail: boolean, signingConfig = config, stage = "") => {
72
+ rmSync(join(root, "env"), { force: true });
73
+ return spawnSync("bash", [script], {
74
+ cwd: root,
75
+ encoding: "utf8",
76
+ env: {
77
+ ...process.env,
78
+ PATH: `${bin}:${process.env.PATH}`,
79
+ RUNNER_TEMP: root,
80
+ GITHUB_ENV: join(root, "env"),
81
+ CALLS: join(root, "calls"),
82
+ MACOS_SIGNING_CONFIG: signingConfig,
83
+ FAIL_VERIFY: String(fail),
84
+ FAIL_STAGE: stage,
85
+ },
86
+ });
87
+ };
88
+ const success = run(false);
89
+ assert.equal(success.status, 0, success.stderr);
90
+ assert.match(
91
+ readFileSync(join(root, "env"), "utf8"),
92
+ /MACOS_NOTARIZE=true\n$/,
93
+ );
94
+ assert.match(readFileSync(join(root, "calls"), "utf8"), /delete-keychain/);
95
+ rmSync(join(root, "env"));
96
+ const failed = run(true);
97
+ assert.notEqual(failed.status, 0);
98
+ assert.equal(
99
+ (failed.stdout + failed.stderr).includes("fixture-password"),
100
+ false,
101
+ );
102
+ assert.doesNotMatch(
103
+ readFileSync(join(root, "env"), "utf8"),
104
+ /MACOS_NOTARIZE=true/,
105
+ );
106
+ assert.equal(
107
+ readFileSync(join(root, "calls"), "utf8").match(/delete-keychain/g)
108
+ ?.length,
109
+ 2,
110
+ );
111
+ assert.equal(
112
+ readdirSync(root).some((name) => name.startsWith("macos-signing.")),
113
+ false,
114
+ );
115
+ for (const stage of ["signature", "staple", "assess", "mismatch"]) {
116
+ const invalidDmg = run(false, config, stage);
117
+ assert.notEqual(invalidDmg.status, 0, stage);
118
+ assert.doesNotMatch(
119
+ readFileSync(join(root, "env"), "utf8"),
120
+ /MACOS_NOTARIZE=true/,
121
+ );
122
+ assert.equal(
123
+ readdirSync(root).some((name) => name.startsWith("macos-signing.")),
124
+ false,
125
+ );
126
+ }
127
+ assert.equal(
128
+ readFileSync(join(root, "calls"), "utf8").match(/^detach$/gm)?.length,
129
+ 5,
130
+ );
131
+ for (const stage of ["attach", "detach"]) {
132
+ assert.notEqual(run(false, config, stage).status, 0, stage);
133
+ assert.doesNotMatch(
134
+ readFileSync(join(root, "env"), "utf8"),
135
+ /MACOS_NOTARIZE=true/,
136
+ );
137
+ const directories = readdirSync(root).filter((name) =>
138
+ name.startsWith("macos-signing."),
139
+ );
140
+ assert.equal(directories.length, stage === "detach" ? 1 : 0);
141
+ for (const directory of directories) {
142
+ const remaining = join(root, directory);
143
+ assert.equal(
144
+ spawnSync("test", ["-e", join(remaining, "AuthKey.p8")]).status,
145
+ 1,
146
+ );
147
+ assert.equal(
148
+ spawnSync("test", ["-e", join(remaining, "certificate.p12")]).status,
149
+ 1,
150
+ );
151
+ // This is a mock directory, not a real mounted volume.
152
+ rmSync(remaining, { recursive: true });
153
+ }
154
+ }
155
+ const incomplete = run(false, JSON.stringify({ identity: "incomplete" }));
156
+ assert.notEqual(incomplete.status, 0);
157
+ assert.equal(spawnSync("test", ["-e", join(root, "env")]).status, 1);
158
+ const unsigned = run(false, "");
159
+ assert.equal(unsigned.status, 0, unsigned.stderr);
160
+ assert.equal(spawnSync("test", ["-e", join(root, "env")]).status, 1);
161
+ const leftover = join(root, "macos-signing.12345678");
162
+ const otherJob = join(root, "macos-signing.87654321");
163
+ mkdirSync(leftover);
164
+ mkdirSync(otherJob);
165
+ writeFileSync(join(leftover, "AuthKey.p8"), "fixture");
166
+ const cleanup = spawnSync("bash", [script, "cleanup"], {
167
+ cwd: root,
168
+ encoding: "utf8",
169
+ env: {
170
+ ...process.env,
171
+ PATH: `${bin}:${process.env.PATH}`,
172
+ RUNNER_TEMP: root,
173
+ MACOS_SIGNING_DIRECTORY: leftover,
174
+ CALLS: join(root, "calls"),
175
+ },
176
+ });
177
+ assert.equal(cleanup.status, 0, cleanup.stderr);
178
+ assert.equal(spawnSync("test", ["-e", leftover]).status, 1);
179
+ assert.equal(spawnSync("test", ["-d", otherJob]).status, 0);
180
+ } finally {
181
+ rmSync(root, { recursive: true, force: true });
182
+ }
183
+ });
184
+
185
+ test("macOS workflow publishes only verified signed artifacts", () => {
186
+ const parsed = spawnSync(
187
+ process.execPath,
188
+ [
189
+ "-e",
190
+ "console.log(JSON.stringify(Bun.YAML.parse(await Bun.stdin.text())))",
191
+ ],
192
+ {
193
+ input: readFileSync(
194
+ resolve(import.meta.dirname, "../../.github/workflows/pipeline.yml"),
195
+ "utf8",
196
+ ),
197
+ encoding: "utf8",
198
+ },
199
+ );
200
+ assert.equal(parsed.status, 0, parsed.stderr);
201
+ const workflow = JSON.parse(parsed.stdout);
202
+ const steps = workflow.jobs.desktop.steps as Array<Record<string, any>>;
203
+ const find = (name: string) => steps.find((step) => step.name === name);
204
+ assert.equal(
205
+ find("Build macOS")?.run,
206
+ "bash .github/scripts/macos-release.sh",
207
+ );
208
+ assert.match(
209
+ find("Upload desktop release artifacts")?.if,
210
+ /MACOS_NOTARIZE == 'true'/,
211
+ );
212
+ assert.match(
213
+ find("Upload unsigned macOS artifact")?.if,
214
+ /MACOS_NOTARIZE != 'true'/,
215
+ );
216
+ assert.match(
217
+ find("Publish desktop update feed")?.if,
218
+ /MACOS_NOTARIZE == 'true'/,
219
+ );
220
+ assert.match(find("Clean up macOS signing")?.if, /always\(\)/);
221
+ const script = readFileSync(
222
+ resolve(import.meta.dirname, "../../.github/scripts/release.sh"),
223
+ "utf8",
224
+ );
225
+ assert.match(script, /for platform in android linux windows macos/);
226
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-disposabl-app",
3
- "version": "0.14.18",
3
+ "version": "0.15.0",
4
4
  "description": "Create a Disposabl app",
5
5
  "type": "module",
6
6
  "license": "MIT",