create-disposabl-app 0.18.1 → 0.19.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
@@ -3,7 +3,7 @@
3
3
  // ../cli/auth.ts
4
4
  import { lock } from "proper-lockfile";
5
5
  // ../cli/package.json
6
- var version = "0.18.1";
6
+ var version = "0.19.0";
7
7
  var package_default = {
8
8
  name: "@disposabl/cli",
9
9
  version,
package/dist/index.js CHANGED
@@ -1563,7 +1563,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
1563
1563
  import { Command, CommanderError } from "commander";
1564
1564
  import * as p2 from "@clack/prompts";
1565
1565
  // package.json
1566
- var version = "0.18.1";
1566
+ var version = "0.19.0";
1567
1567
 
1568
1568
  // ../cli/telemetry.ts
1569
1569
  var import_proper_lockfile2 = __toESM(require_proper_lockfile(), 1);
@@ -8,15 +8,21 @@ platform=$PACKAGE
8
8
  bun run generate
9
9
  bun run --cwd "packages/$PACKAGE" typecheck
10
10
  name=$(node -p "require('./packages/$PACKAGE/package.json').name")
11
- if ! previous=$(npm view "$name" version 2>/dev/null); then
12
- node .github/scripts/disposabl.mjs report "$platform" blocked 'Publish the package once and configure npm trusted publishing.'
13
- exit 0
14
- fi
15
11
  node .github/scripts/disposabl.mjs report "$platform" building
16
12
  if GITHUB_TOKEN="$GH_TOKEN" npm_config_workspaces_update=false bun run --cwd "packages/$PACKAGE" release; then
17
13
  version=$(node -p "require('./packages/$PACKAGE/package.json').version")
18
- [[ "$version" != *development* ]] || version=$previous
19
- PUBLISHED_VERSION=$(npm view "$name@$version" version)
14
+ # semantic-release may succeed without a new release. Verify latest in that
15
+ # case, but never require a public version before attempting OIDC publication.
16
+ published="$name@$version"
17
+ [[ "$version" != *development* ]] || published=$name
18
+ if ! PUBLISHED_VERSION=$(npm view "$published" version); then
19
+ node .github/scripts/disposabl.mjs report "$platform" failed 'Release finished, but npm availability could not be verified; check the registry lookup error.'
20
+ exit 1
21
+ fi
22
+ if [[ -z "$PUBLISHED_VERSION" || ( "$published" != "$name" && "$PUBLISHED_VERSION" != "$version" ) ]]; then
23
+ node .github/scripts/disposabl.mjs report "$platform" failed 'npm returned no matching published version.'
24
+ exit 1
25
+ fi
20
26
  export PUBLISHED_VERSION
21
27
  node .github/scripts/disposabl.mjs report "$platform" ready
22
28
  else
@@ -1,538 +1 @@
1
- name: Pipeline
2
- on:
3
- pull_request:
4
- branches: [main]
5
- push:
6
- branches: [main]
7
- permissions:
8
- contents: read
9
- pull-requests: read
10
- concurrency:
11
- group: ${{ github.workflow }}-${{ github.ref }}
12
- # Cancel obsolete PRs; finish active production releases and keep only the latest pending run.
13
- cancel-in-progress: ${{ github.event_name == 'pull_request' }}
14
- env:
15
- CHANNEL: &channel ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || 'production' }}
16
- DISPOSABL_MOBILE_CHANNEL: *channel
17
- EAS_ENVIRONMENT: ${{ github.event_name == 'push' && 'production' || 'preview' }}
18
- EAS_CLI: eas-cli@27.2.0
19
- BUN_VERSION: &bun-version "1.4.4"
20
- NODE_VERSION: &node-version "24"
21
- LINUX_RUNNER: &linux-runner ubuntu-24.04
22
- WEB_RUNNER: ubuntu-24.04
23
- WINDOWS_RUNNER: windows-2025
24
- MACOS_RUNNER: macos-26
25
- RELEASE_PREFIX: app
26
- DISPOSABL_ANDROID_VERSION_CODE: ${{ github.run_number }}
27
- DISPOSABL_IOS_BUILD_NUMBER: ${{ github.run_number }}
28
- # Build jobs only read this repository. Keep installation tokens in publishing jobs.
29
- GH_TOKEN: ${{ github.token }}
30
- GH_REPO: ${{ github.repository }}
31
- SOURCE: ${{ github.event.pull_request.head.sha || github.sha }}
32
- SOURCE_PATH: ${{ github.event_name == 'pull_request' && format('pulls/{0}', github.event.number) || 'git/ref/heads/main' }}
33
- DISPOSABL_RELEASE_VERSION: 1.0.${{ github.run_number }}
34
- jobs:
35
- changes:
36
- name: Select work
37
- if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
38
- permissions:
39
- contents: read
40
- pull-requests: read
41
- actions: read
42
- runs-on: *linux-runner
43
- timeout-minutes: 5
44
- outputs:
45
- linux_runner: ${{ steps.platforms.outputs.linux_runner }}
46
- android_runner: ${{ steps.platforms.outputs.android_runner }}
47
- macos_runner: ${{ steps.platforms.outputs.macos_runner }}
48
- changed: ${{ steps.platforms.outputs.changed }}
49
- android: ${{ steps.platforms.outputs.android }}
50
- ios: ${{ steps.platforms.outputs.ios }}
51
- desktop: ${{ steps.platforms.outputs.desktop }}
52
- packages: ${{ steps.platforms.outputs.packages }}
53
- steps:
54
- - &checkout
55
- uses: actions/checkout@v6
56
- with: { ref: "${{ env.SOURCE }}", persist-credentials: false }
57
- - name: Select affected platforms
58
- shell: bash
59
- id: platforms
60
- env:
61
- PR: ${{ github.event.number }}
62
- EXPO_CONNECTED: ${{ secrets.EXPO_TOKEN != '' }}
63
- IOS_BUILDS_ENABLED: ${{ vars.IOS_BUILDS_ENABLED != 'false' }}
64
- run: bash "$GITHUB_WORKSPACE/.github/scripts/platforms.sh"
65
- web:
66
- name: Web
67
- needs: changes
68
- # Fork code must not run in a job with deployment credentials.
69
- if: needs.changes.outputs.changed == 'true'
70
- permissions: &release-permissions
71
- contents: read
72
- pull-requests: read
73
- id-token: write
74
- timeout-minutes: 20
75
- runs-on: ${{ needs.changes.outputs.linux_runner }}
76
- outputs:
77
- desktop: ${{ needs.changes.outputs.desktop }}
78
- ios: ${{ needs.changes.outputs.ios }}
79
- packages: ${{ needs.changes.outputs.packages }}
80
- release: ${{ steps.artifacts.outcome == 'success' }}
81
- android_build: ${{ steps.fingerprint.outputs.build }}
82
- android_runtime: ${{ steps.fingerprint.outputs.runtime }}
83
- convex_url: ${{ steps.deploy.outputs.CONVEX_URL }}
84
- convex_site_url: ${{ steps.deploy.outputs.CONVEX_SITE_URL }}
85
- env:
86
- PLATFORM: android
87
- ANDROID_SIGNING_READY: ${{ secrets.DISPOSABL_ANDROID_SIGNING != '' || (secrets.ANDROID_KEYSTORE_BASE64 != '' && secrets.ANDROID_KEYSTORE_PASSWORD != '' && secrets.ANDROID_KEY_ALIAS != '' && secrets.ANDROID_KEY_PASSWORD != '') }}
88
- EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
89
- EXPO_PROJECT_ID: ${{ secrets.EXPO_PROJECT_ID || vars.EXPO_PROJECT_ID }}
90
- EXPO_OWNER: ${{ secrets.EXPO_OWNER || vars.EXPO_OWNER }}
91
- EXPO_SLUG: ${{ secrets.EXPO_SLUG || vars.EXPO_SLUG }}
92
- EXPO_NO_DOTENV: "1"
93
- steps:
94
- - *checkout
95
- - &node
96
- uses: actions/setup-node@v6
97
- with: { node-version: *node-version, package-manager-cache: false }
98
- - &bun
99
- uses: oven-sh/setup-bun@v2
100
- with: { bun-version: *bun-version }
101
- - &cache
102
- uses: actions/cache@v4
103
- with:
104
- path: ~/.bun/install/cache
105
- key: bun-${{ github.job == 'desktop' && 'desktop-' || '' }}${{ runner.os }}-${{ runner.arch }}-${{ env.BUN_VERSION }}-${{ hashFiles('bun.lock') }}
106
- restore-keys: bun-${{ github.job == 'desktop' && 'desktop-' || '' }}${{ runner.os }}-${{ runner.arch }}-${{ env.BUN_VERSION }}-
107
- - &install
108
- run: bun install --frozen-lockfile ${{ github.job == 'desktop' && '--filter "*desktop*" --filter @disposabl/backend' || (github.job == 'android' || startsWith(github.job, 'ios-')) && '--filter @disposabl/mobile' || '' }}
109
- - name: Report build start
110
- run: |
111
- node .github/scripts/disposabl.mjs report web,api,mcp building
112
- if [[ -z "$EXPO_TOKEN" ]]; then node .github/scripts/disposabl.mjs report android blocked 'Connect Expo before building Android.'; fi
113
- if [[ '${{ github.event_name }}' == pull_request ]]; then node .github/scripts/disposabl.mjs report cli,typescript-sdk blocked 'Packages publish after merge to main.'; fi
114
- - name: Check
115
- run: bun run check
116
- - name: Build selected clients
117
- run: |
118
- for package in cli sdk; do
119
- if test -f "packages/$package/package.json"; then bun run --cwd "packages/$package" build; fi
120
- done
121
- - name: Deploy
122
- id: deploy
123
- timeout-minutes: 10
124
- env:
125
- TRUSTED: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
126
- CONVEX_DEPLOY_KEY: ${{ secrets[github.event_name == 'push' && 'CONVEX_DEPLOY_KEY' || 'CONVEX_DEPLOY_KEY_PREVIEW'] }}
127
- run: |
128
- if [[ "$TRUSTED" != true ]]; then VITE_CONVEX_URL=https://ci.invalid VITE_CONVEX_SITE_URL=https://ci.invalid bun run build --filter=@disposabl/web; exit; fi
129
- : "${CONVEX_DEPLOY_KEY:?Configure the Convex deployment secret for this repository}"
130
- cd packages/backend
131
- export AUTH_TARGET=--prod
132
- target=()
133
- if [[ "$CHANNEL" != production ]]; then export AUTH_TARGET="--preview-name $CHANNEL"; target=(--preview-name "$CHANNEL"); fi
134
- bun x --no-install convex deploy --yes "${target[@]}" --cmd-url-env-var-name CONVEX_URL --cmd 'for name in CONVEX_URL CONVEX_SITE_URL; do value=$(printenv "$name"); test -n "$value" || exit 1; for prefix in "" VITE_ EXPO_PUBLIC_; do export "$prefix$name=$value"; printf "%s=%s\n" "$prefix$name" "$value" | tee -a "$GITHUB_ENV" >> "$GITHUB_OUTPUT"; done; done; bun run --cwd ../.. build --filter=@disposabl/web'
135
- setup_target=(--prod)
136
- if [[ "$CHANNEL" != production ]]; then setup_target=("${target[@]}"); fi
137
- bun x --no-install convex run "${setup_target[@]}" billing:setup '{}'
138
- bun x --no-install static-hosting upload $AUTH_TARGET --no-spa --dist ../../apps/web/dist/client
139
- - name: Report web result
140
- if: always()
141
- run: node .github/scripts/disposabl.mjs report web,api,mcp ${{ steps.deploy.outcome == 'success' && 'ready' || 'failed' }}
142
- - name: Expo
143
- if: needs.changes.outputs.android == 'true'
144
- working-directory: apps/mobile
145
- run: bash "$GITHUB_WORKSPACE/.github/scripts/mobile.sh" expo-env
146
- - name: Channel
147
- if: needs.changes.outputs.android == 'true'
148
- working-directory: apps/mobile
149
- run: bash "$GITHUB_WORKSPACE/.github/scripts/mobile.sh" expo-channel
150
- - name: Fingerprint
151
- id: fingerprint
152
- if: needs.changes.outputs.android == 'true'
153
- working-directory: apps/mobile
154
- run: bash "$GITHUB_WORKSPACE/.github/scripts/mobile.sh" expo-fingerprint
155
- - name: Update
156
- if: steps.fingerprint.outputs.build == 'false'
157
- env:
158
- TAG: ${{ steps.fingerprint.outputs.tag }}
159
- SHA: ${{ steps.fingerprint.outputs.sha }}
160
- RUNTIME: ${{ steps.fingerprint.outputs.runtime }}
161
- run: bash "$GITHUB_WORKSPACE/.github/scripts/mobile.sh" expo-update
162
- - &publish
163
- name: Publish
164
- if: github.job == 'android' || (github.job == 'web' && hashFiles('dist/release/android.json') != '') || github.job == 'desktop'
165
- shell: bash
166
- run: bash "$GITHUB_WORKSPACE/.github/scripts/release.sh" verify-artifacts
167
- - &artifacts
168
- name: Upload release artifacts
169
- id: artifacts
170
- if: hashFiles('dist/release/*') != ''
171
- uses: actions/upload-artifact@v4
172
- with:
173
- name: release-${{ env.PLATFORM }}
174
- path: dist/release/
175
- retention-days: 3
176
- compression-level: 0
177
- if-no-files-found: error
178
- android:
179
- name: Android
180
- needs: [changes, web]
181
- if: needs.web.outputs.android_build == 'true'
182
- permissions: *release-permissions
183
- runs-on: ${{ needs.changes.outputs.android_runner }}
184
- timeout-minutes: 20
185
- env:
186
- PLATFORM: android
187
- EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
188
- EXPO_PROJECT_ID: ${{ secrets.EXPO_PROJECT_ID || vars.EXPO_PROJECT_ID }}
189
- EXPO_OWNER: ${{ secrets.EXPO_OWNER || vars.EXPO_OWNER }}
190
- EXPO_SLUG: ${{ secrets.EXPO_SLUG || vars.EXPO_SLUG }}
191
- EXPO_NO_DOTENV: "1"
192
- CONVEX_URL: ${{ needs.web.outputs.convex_url }}
193
- CONVEX_SITE_URL: ${{ needs.web.outputs.convex_site_url }}
194
- EXPO_PUBLIC_CONVEX_URL: ${{ needs.web.outputs.convex_url }}
195
- EXPO_PUBLIC_CONVEX_SITE_URL: ${{ needs.web.outputs.convex_site_url }}
196
- steps:
197
- - *checkout
198
- - name: Prepare Android disk space
199
- run: bash .github/scripts/android-runner.sh prepare
200
- - *node
201
- - *bun
202
- - *cache
203
- - *install
204
- - name: Report mobile build
205
- run: node .github/scripts/disposabl.mjs report "$PLATFORM" building
206
- - name: Expo
207
- working-directory: apps/mobile
208
- run: bash "$GITHUB_WORKSPACE/.github/scripts/mobile.sh" expo-env
209
- - name: Java
210
- uses: actions/setup-java@v5
211
- with: { distribution: temurin, java-version: "17" }
212
- - name: SDK
213
- uses: android-actions/setup-android@v3
214
- with: { packages: platform-tools }
215
- - name: Gradle
216
- uses: gradle/actions/setup-gradle@v4
217
- with: { cache-read-only: false }
218
- - name: Restore native compiler cache
219
- if: github.event_name == 'push'
220
- id: native-cache
221
- uses: actions/cache/restore@v4
222
- with:
223
- path: ${{ runner.temp }}/ccache
224
- key: android-ccache-v1-${{ runner.os }}-${{ runner.arch }}-${{ github.sha }}
225
- - name: Install native compiler cache
226
- if: github.event_name == 'push' && steps.native-cache.outputs.cache-hit == 'true'
227
- run: |
228
- sudo apt-get update -qq
229
- sudo apt-get install -y ccache
230
- printf 'CCACHE_DIR=%s\nCCACHE_COMPILERCHECK=content\nCMAKE_C_COMPILER_LAUNCHER=ccache\nCMAKE_CXX_COMPILER_LAUNCHER=ccache\n' "$RUNNER_TEMP/ccache" >> "$GITHUB_ENV"
231
- - name: Build
232
- working-directory: apps/mobile
233
- env:
234
- RUNTIME: ${{ needs.web.outputs.android_runtime }}
235
- DISPOSABL_ANDROID_CHANNEL: *channel
236
- DISPOSABL_ANDROID_SIGNING: ${{ github.event_name == 'push' && secrets.DISPOSABL_ANDROID_SIGNING || '' }}
237
- ANDROID_KEYSTORE_BASE64: ${{ github.event_name == 'push' && secrets.ANDROID_KEYSTORE_BASE64 || '' }}
238
- ANDROID_KEYSTORE_PASSWORD: ${{ github.event_name == 'push' && secrets.ANDROID_KEYSTORE_PASSWORD || '' }}
239
- ANDROID_KEY_ALIAS: ${{ github.event_name == 'push' && secrets.ANDROID_KEY_ALIAS || '' }}
240
- ANDROID_KEY_PASSWORD: ${{ github.event_name == 'push' && secrets.ANDROID_KEY_PASSWORD || '' }}
241
- run: bash "$GITHUB_WORKSPACE/.github/scripts/mobile.sh" android-build
242
- - *publish
243
- - *artifacts
244
- android-failure:
245
- name: Report Android failure
246
- needs: android
247
- if: always() && (needs.android.result == 'failure' || needs.android.result == 'cancelled')
248
- permissions:
249
- contents: read
250
- id-token: write
251
- runs-on: *linux-runner
252
- timeout-minutes: 5
253
- steps:
254
- - *checkout
255
- - *node
256
- - run: node .github/scripts/disposabl.mjs report android failed "Android build failed or was cancelled; check the workflow log."
257
- ios-preview:
258
- name: iOS simulator preview
259
- needs: [changes, web]
260
- if: github.event_name == 'pull_request' && needs.web.outputs.ios == 'true'
261
- permissions: *release-permissions
262
- runs-on: ${{ needs.changes.outputs.macos_runner }}
263
- timeout-minutes: 20
264
- env:
265
- EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
266
- CONVEX_URL: ${{ needs.web.outputs.convex_url }}
267
- CONVEX_SITE_URL: ${{ needs.web.outputs.convex_site_url }}
268
- EXPO_PUBLIC_CONVEX_URL: ${{ needs.web.outputs.convex_url }}
269
- EXPO_PUBLIC_CONVEX_SITE_URL: ${{ needs.web.outputs.convex_site_url }}
270
- EXPO_PROJECT_ID: ${{ secrets.EXPO_PROJECT_ID || vars.EXPO_PROJECT_ID }}
271
- EXPO_OWNER: ${{ secrets.EXPO_OWNER || vars.EXPO_OWNER }}
272
- EXPO_SLUG: ${{ secrets.EXPO_SLUG || vars.EXPO_SLUG }}
273
- EXPO_NO_DOTENV: "1"
274
- steps:
275
- - *checkout
276
- - *node
277
- - *bun
278
- - *cache
279
- - *install
280
- - name: Report build
281
- run: node .github/scripts/disposabl.mjs report ios building
282
- - name: Load Expo environment
283
- if: env.EXPO_TOKEN != ''
284
- working-directory: apps/mobile
285
- run: bash "$GITHUB_WORKSPACE/.github/scripts/mobile.sh" expo-env
286
- - name: Verify update channel
287
- if: env.EXPO_TOKEN != ''
288
- working-directory: apps/mobile
289
- run: bash "$GITHUB_WORKSPACE/.github/scripts/mobile.sh" expo-channel
290
- - name: Publish compatible iOS preview update
291
- if: env.EXPO_TOKEN != ''
292
- working-directory: apps/mobile
293
- run: bash "$GITHUB_WORKSPACE/.github/scripts/apple.sh" ota
294
- - name: Xcode toolchain
295
- run: |
296
- xcodebuild -version
297
- xcrun swift --version
298
- - name: Build simulator archive
299
- working-directory: apps/mobile
300
- run: bash "$GITHUB_WORKSPACE/.github/scripts/apple.sh" simulator
301
- - uses: actions/upload-artifact@v4
302
- with:
303
- name: ios-simulator
304
- path: dist/apple/ios-simulator.zip
305
- retention-days: 3
306
- compression-level: 0
307
- if-no-files-found: error
308
- - name: Report simulator archive
309
- run: |
310
- echo 'iOS simulator archive is available in this workflow run’s artifacts; it is not a device or TestFlight build.' >> "$GITHUB_STEP_SUMMARY"
311
- node .github/scripts/disposabl.mjs report ios ready 'Simulator archive available in workflow artifacts.'
312
- - name: Report failure
313
- if: failure() || cancelled()
314
- run: node .github/scripts/disposabl.mjs report ios failed 'iOS simulator build failed; check the workflow log.'
315
- ios-production:
316
- name: iOS production and TestFlight
317
- needs: [changes, web]
318
- if: github.event_name == 'push' && needs.web.outputs.ios == 'true'
319
- permissions: *release-permissions
320
- runs-on: ${{ needs.changes.outputs.linux_runner }}
321
- timeout-minutes: 20
322
- env:
323
- EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
324
- EXPO_PROJECT_ID: ${{ secrets.EXPO_PROJECT_ID || vars.EXPO_PROJECT_ID }}
325
- EXPO_OWNER: ${{ secrets.EXPO_OWNER || vars.EXPO_OWNER }}
326
- EXPO_SLUG: ${{ secrets.EXPO_SLUG || vars.EXPO_SLUG }}
327
- EXPO_NO_DOTENV: "1"
328
- CONVEX_URL: ${{ needs.web.outputs.convex_url }}
329
- CONVEX_SITE_URL: ${{ needs.web.outputs.convex_site_url }}
330
- EXPO_PUBLIC_CONVEX_URL: ${{ needs.web.outputs.convex_url }}
331
- EXPO_PUBLIC_CONVEX_SITE_URL: ${{ needs.web.outputs.convex_site_url }}
332
- steps:
333
- - *checkout
334
- - *node
335
- - *bun
336
- - *cache
337
- - *install
338
- - name: Check Expo connection
339
- id: apple-prerequisites
340
- working-directory: apps/mobile
341
- run: bash "$GITHUB_WORKSPACE/.github/scripts/apple.sh" prerequisites
342
- - name: Load Expo environment
343
- if: steps.apple-prerequisites.outputs.ready == 'true'
344
- working-directory: apps/mobile
345
- run: bash "$GITHUB_WORKSPACE/.github/scripts/mobile.sh" expo-env
346
- - name: Verify update channel
347
- if: steps.apple-prerequisites.outputs.ready == 'true'
348
- working-directory: apps/mobile
349
- run: bash "$GITHUB_WORKSPACE/.github/scripts/mobile.sh" expo-channel
350
- - name: Select iOS update or native build
351
- id: ios-plan
352
- if: steps.apple-prerequisites.outputs.ready == 'true'
353
- working-directory: apps/mobile
354
- run: bash "$GITHUB_WORKSPACE/.github/scripts/apple.sh" ota-plan
355
- - name: Publish compatible iOS production update
356
- if: steps.ios-plan.outputs.action == 'update'
357
- working-directory: apps/mobile
358
- env:
359
- RUNTIME: ${{ steps.ios-plan.outputs.runtime }}
360
- run: bash "$GITHUB_WORKSPACE/.github/scripts/apple.sh" ota
361
- - name: Build and submit to TestFlight
362
- if: steps.ios-plan.outputs.action == 'build'
363
- working-directory: apps/mobile
364
- env:
365
- ASC_APP_ID: ${{ secrets.ASC_APP_ID || vars.ASC_APP_ID }}
366
- run: bash "$GITHUB_WORKSPACE/.github/scripts/apple.sh" production
367
- - name: Reconcile delivery of the compatible native build
368
- if: steps.ios-plan.outputs.action == 'update'
369
- working-directory: apps/mobile
370
- env:
371
- BUILD_ID: ${{ steps.ios-plan.outputs.build_id }}
372
- ASC_APP_ID: ${{ secrets.ASC_APP_ID || vars.ASC_APP_ID }}
373
- run: bash "$GITHUB_WORKSPACE/.github/scripts/apple.sh" deliver
374
- - name: Report failure
375
- if: failure() || cancelled()
376
- run: node .github/scripts/disposabl.mjs report ios failed 'iOS update, native build or submission failed; check the workflow log.'
377
- desktop:
378
- needs: web
379
- permissions: *release-permissions
380
- name: ${{ matrix.platform }}
381
- if: github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.web.outputs.desktop != '[]' && needs.web.outputs.desktop != ''
382
- strategy:
383
- fail-fast: false
384
- matrix:
385
- include: ${{ fromJSON(needs.web.outputs.desktop) }}
386
- runs-on: ${{ matrix.runner }}
387
- timeout-minutes: 20
388
- env:
389
- PLATFORM: ${{ matrix.platform }}
390
- DISPOSABL_RELEASE_VERSION: 1.${{ github.run_number }}.${{ github.run_attempt }}
391
- DISPOSABL_DESKTOP_PLATFORM: ${{ matrix.platform }}
392
- DISPOSABL_DESKTOP_UPDATE_CHANNEL: production
393
- CONVEX_SITE_URL: ${{ needs.web.outputs.convex_site_url }}
394
- electron_config_cache: ${{ github.workspace }}/.cache/electron
395
- steps:
396
- - *checkout
397
- - *node
398
- - *bun
399
- - *cache
400
- - *install
401
- - name: Report desktop build
402
- run: node .github/scripts/disposabl.mjs report "$PLATFORM" building
403
- - name: Electron
404
- uses: actions/cache@v4
405
- with:
406
- path: .cache/electron
407
- key: electron-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('bun.lock') }}
408
- - name: Packages
409
- if: matrix.platform == 'linux'
410
- run: command -v fakeroot && command -v rpmbuild && command -v dpkg-deb || { sudo apt-get update && sudo apt-get install -y fakeroot dpkg rpm; }
411
- - name: Configure desktop update identity
412
- shell: bash
413
- run: |
414
- id=$(node -p "require('./disposabl.json').desktopId || ''")
415
- if [[ ! "$id" =~ ^[a-f0-9]{32}$ ]]; then echo 'Desktop identity missing; regenerate this app before its first installation.' >&2; exit 1; fi
416
- echo "DISPOSABL_DESKTOP_ID=$id" >> "$GITHUB_ENV"
417
- echo "DISPOSABL_DESKTOP_UPDATE_URL=${CONVEX_SITE_URL}/desktop/updates/$id" >> "$GITHUB_ENV"
418
- - name: Build
419
- if: matrix.platform != 'macos'
420
- run: bun run --cwd apps/desktop preview
421
- - name: Build macOS
422
- if: matrix.platform == 'macos'
423
- shell: bash
424
- env:
425
- MACOS_SIGNING_CONFIG: ${{ secrets.MACOS_SIGNING_CONFIG }}
426
- run: bash .github/scripts/macos-release.sh
427
- - *publish
428
- - name: Publish desktop update feed
429
- if: matrix.platform == 'windows' || (matrix.platform == 'macos' && env.MACOS_NOTARIZE == 'true')
430
- shell: bash
431
- env:
432
- CONVEX_DEPLOY_KEY: ${{ secrets.CONVEX_DEPLOY_KEY }}
433
- run: |
434
- test "$(gh api "repos/$GH_REPO/git/ref/heads/main" --jq .object.sha)" = "$SOURCE"
435
- node apps/desktop/publish-update.mjs
436
- - name: Upload desktop release artifacts
437
- if: matrix.platform != 'macos' || env.MACOS_NOTARIZE == 'true'
438
- uses: actions/upload-artifact@v4
439
- with:
440
- name: release-${{ env.PLATFORM }}
441
- path: dist/release/
442
- retention-days: 3
443
- compression-level: 0
444
- if-no-files-found: error
445
- - name: Upload staged update feed
446
- if: matrix.platform != 'linux' && env.DISPOSABL_DESKTOP_UPDATE_URL != '' && (matrix.platform != 'macos' || env.MACOS_NOTARIZE == 'true')
447
- uses: actions/upload-artifact@v4
448
- with:
449
- name: desktop-update-${{ env.PLATFORM }}
450
- path: dist/update/
451
- retention-days: 3
452
- if-no-files-found: error
453
- - name: Upload unsigned macOS artifact
454
- if: matrix.platform == 'macos' && env.MACOS_NOTARIZE != 'true'
455
- uses: actions/upload-artifact@v4
456
- with:
457
- name: macos-unsigned
458
- path: |
459
- dist/release/*.dmg
460
- dist/release/*.zip
461
- retention-days: 3
462
- compression-level: 0
463
- if-no-files-found: error
464
- - name: Report macOS artifact
465
- if: matrix.platform == 'macos' && env.MACOS_NOTARIZE != 'true'
466
- run: |
467
- echo 'macOS DMG is ad-hoc signed, not Developer ID signed or notarized. Download it from this workflow run’s artifacts.' >> "$GITHUB_STEP_SUMMARY"
468
- node .github/scripts/disposabl.mjs report macos blocked 'Ad-hoc signed DMG available in workflow artifacts; Developer ID signing and notarization are not configured.'
469
- - name: Report desktop failure
470
- if: failure() || cancelled()
471
- run: node .github/scripts/disposabl.mjs report "$PLATFORM" failed
472
- - name: Clean up macOS signing
473
- if: always() && matrix.platform == 'macos'
474
- shell: bash
475
- run: bash .github/scripts/macos-release.sh cleanup
476
- packages:
477
- name: Package / ${{ matrix.package }}
478
- needs: [changes, web]
479
- if: github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.web.outputs.packages != '[]' && needs.web.outputs.packages != ''
480
- runs-on: ${{ needs.changes.outputs.linux_runner }}
481
- timeout-minutes: 15
482
- permissions:
483
- contents: write
484
- id-token: write
485
- concurrency:
486
- group: npm-${{ matrix.package }}
487
- cancel-in-progress: false
488
- strategy:
489
- fail-fast: false
490
- matrix:
491
- package: ${{ fromJSON(needs.web.outputs.packages) }}
492
- env:
493
- PACKAGE: ${{ matrix.package }}
494
- steps:
495
- - uses: actions/checkout@v6
496
- with: { fetch-depth: 0, persist-credentials: false }
497
- - *node
498
- - *bun
499
- - *cache
500
- - *install
501
- - name: Disposabl GitHub App token
502
- run: node .github/scripts/disposabl.mjs token
503
- - name: Publish package if configured
504
- run: bash .github/scripts/release.sh package-release
505
-
506
- # The publisher executes scripts from main only; the authorizer verifies workflow_sha.
507
- publish:
508
- needs: [changes, web, android, desktop]
509
- if: always() && !cancelled() && needs.web.result == 'success' && (needs.web.outputs.release == 'true' || needs.android.result == 'success' || needs.desktop.result == 'success')
510
- environment: publishing
511
- runs-on: ${{ needs.changes.outputs.linux_runner }}
512
- timeout-minutes: 15
513
- permissions:
514
- contents: write
515
- actions: read
516
- id-token: write
517
- steps:
518
- - uses: actions/checkout@v6
519
- with:
520
- ref: main
521
- persist-credentials: false
522
- - uses: actions/setup-node@v6
523
- with:
524
- node-version: "24"
525
- package-manager-cache: false
526
- - name: Disposabl installation token
527
- run: node .github/scripts/disposabl.mjs token
528
- - name: Select release source
529
- id: source
530
- run: bash .github/scripts/release.sh release-source
531
- - uses: actions/download-artifact@v4
532
- if: steps.source.outputs.current == 'true'
533
- with:
534
- pattern: release-*
535
- path: artifacts
536
- - name: Publish verified build artifacts
537
- if: steps.source.outputs.current == 'true'
538
- run: bash .github/scripts/release.sh release-publish
1
+ {name: Pipeline,"on": {pull_request: {branches: [main]},push: {branches: [main]}},permissions: {contents: read,pull-requests: read},concurrency: {group: "${{ github.workflow }}-${{ github.ref }}",cancel-in-progress: "${{ github.event_name == 'pull_request' }}"},env: {CHANNEL: "${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || 'production' }}",DISPOSABL_MOBILE_CHANNEL: "${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || 'production' }}",EAS_ENVIRONMENT: "${{ github.event_name == 'push' && 'production' || 'preview' }}",EAS_CLI: eas-cli@27.2.0,BUN_VERSION: 1.4.4,NODE_VERSION: "24",LINUX_RUNNER: ubuntu-24.04,WEB_RUNNER: ubuntu-24.04,WINDOWS_RUNNER: windows-2025,MACOS_RUNNER: macos-26,RELEASE_PREFIX: app,DISPOSABL_ANDROID_VERSION_CODE: "${{ github.run_number }}",DISPOSABL_IOS_BUILD_NUMBER: "${{ github.run_number }}",GH_TOKEN: "${{ github.token }}",GH_REPO: "${{ github.repository }}",SOURCE: "${{ github.event.pull_request.head.sha || github.sha }}",SOURCE_PATH: "${{ github.event_name == 'pull_request' && format('pulls/{0}', github.event.number) || 'git/ref/heads/main' }}",DISPOSABL_RELEASE_VERSION: "1.0.${{ github.run_number }}"},jobs: {changes: {name: Select work,if: "github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository",permissions: {contents: read,pull-requests: read,actions: read},runs-on: ubuntu-24.04,timeout-minutes: 5,outputs: {linux_runner: "${{ steps.platforms.outputs.linux_runner }}",android_runner: "${{ steps.platforms.outputs.android_runner }}",macos_runner: "${{ steps.platforms.outputs.macos_runner }}",changed: "${{ steps.platforms.outputs.changed }}",android: "${{ steps.platforms.outputs.android }}",ios: "${{ steps.platforms.outputs.ios }}",desktop: "${{ steps.platforms.outputs.desktop }}",packages: "${{ steps.platforms.outputs.packages }}"},steps: [&item0 {uses: actions/checkout@v6,with: {ref: "${{ env.SOURCE }}",persist-credentials: false}},{name: Select affected platforms,shell: bash,id: platforms,env: {PR: "${{ github.event.number }}",EXPO_CONNECTED: "${{ secrets.EXPO_TOKEN != '' }}",IOS_BUILDS_ENABLED: "${{ vars.IOS_BUILDS_ENABLED != 'false' }}"},run: "bash \"$GITHUB_WORKSPACE/.github/scripts/platforms.sh\""}]},web: {name: Web,needs: changes,if: "needs.changes.outputs.changed == 'true'",permissions: &permissions {contents: read,pull-requests: read,id-token: write},timeout-minutes: 20,runs-on: "${{ needs.changes.outputs.linux_runner }}",outputs: {desktop: "${{ needs.changes.outputs.desktop }}",ios: "${{ needs.changes.outputs.ios }}",packages: "${{ needs.changes.outputs.packages }}",release: "${{ steps.artifacts.outcome == 'success' }}",android_build: "${{ steps.fingerprint.outputs.build }}",android_runtime: "${{ steps.fingerprint.outputs.runtime }}",convex_url: "${{ steps.deploy.outputs.CONVEX_URL }}",convex_site_url: "${{ steps.deploy.outputs.CONVEX_SITE_URL }}"},env: {PLATFORM: android,ANDROID_SIGNING_READY: "${{ secrets.DISPOSABL_ANDROID_SIGNING != '' || (secrets.ANDROID_KEYSTORE_BASE64 != '' && secrets.ANDROID_KEYSTORE_PASSWORD != '' && secrets.ANDROID_KEY_ALIAS != '' && secrets.ANDROID_KEY_PASSWORD != '') }}",EXPO_TOKEN: "${{ secrets.EXPO_TOKEN }}",EXPO_PROJECT_ID: "${{ secrets.EXPO_PROJECT_ID || vars.EXPO_PROJECT_ID }}",EXPO_OWNER: "${{ secrets.EXPO_OWNER || vars.EXPO_OWNER }}",EXPO_SLUG: "${{ secrets.EXPO_SLUG || vars.EXPO_SLUG }}",EXPO_NO_DOTENV: "1"},steps: [*item0,&item1 {uses: actions/setup-node@v6,with: {node-version: "24",package-manager-cache: false}},&item2 {uses: oven-sh/setup-bun@v2,with: {bun-version: 1.4.4}},&item3 {uses: actions/cache@v4,with: {path: ~/.bun/install/cache,key: "bun-${{ github.job == 'desktop' && 'desktop-' || '' }}${{ runner.os }}-${{ runner.arch }}-${{ env.BUN_VERSION }}-${{ hashFiles('bun.lock') }}",restore-keys: "bun-${{ github.job == 'desktop' && 'desktop-' || '' }}${{ runner.os }}-${{ runner.arch }}-${{ env.BUN_VERSION }}-"}},&item4 {run: "bun install --frozen-lockfile ${{ github.job == 'desktop' && '--filter \"*desktop*\" --filter @disposabl/backend' || (github.job == 'android' || startsWith(github.job, 'ios-')) && '--filter @disposabl/mobile' || '' }}"},{name: Report build start,run: "node .github/scripts/disposabl.mjs report web,api,mcp building\nif [[ -z \"$EXPO_TOKEN\" ]]; then node .github/scripts/disposabl.mjs report android blocked 'Connect Expo before building Android.'; fi\nif [[ '${{ github.event_name }}' == pull_request ]]; then node .github/scripts/disposabl.mjs report cli,typescript-sdk blocked 'Packages publish after merge to main.'; fi\n"},{name: Check,run: bun run check},{name: Build selected clients,run: "for package in cli sdk; do\n if test -f \"packages/$package/package.json\"; then bun run --cwd \"packages/$package\" build; fi\ndone\n"},{name: Deploy,id: deploy,timeout-minutes: 10,env: {TRUSTED: "${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}",CONVEX_DEPLOY_KEY: "${{ secrets[github.event_name == 'push' && 'CONVEX_DEPLOY_KEY' || 'CONVEX_DEPLOY_KEY_PREVIEW'] }}"},run: "if [[ \"$TRUSTED\" != true ]]; then VITE_CONVEX_URL=https://ci.invalid VITE_CONVEX_SITE_URL=https://ci.invalid bun run build --filter=@disposabl/web; exit; fi\n: \"${CONVEX_DEPLOY_KEY:?Configure the Convex deployment secret for this repository}\"\ncd packages/backend\nexport AUTH_TARGET=--prod\ntarget=()\nif [[ \"$CHANNEL\" != production ]]; then export AUTH_TARGET=\"--preview-name $CHANNEL\"; target=(--preview-name \"$CHANNEL\"); fi\nbun x --no-install convex deploy --yes \"${target[@]}\" --cmd-url-env-var-name CONVEX_URL --cmd 'for name in CONVEX_URL CONVEX_SITE_URL; do value=$(printenv \"$name\"); test -n \"$value\" || exit 1; for prefix in \"\" VITE_ EXPO_PUBLIC_; do export \"$prefix$name=$value\"; printf \"%s=%s\\n\" \"$prefix$name\" \"$value\" | tee -a \"$GITHUB_ENV\" >> \"$GITHUB_OUTPUT\"; done; done; bun run --cwd ../.. build --filter=@disposabl/web'\nsetup_target=(--prod)\nif [[ \"$CHANNEL\" != production ]]; then setup_target=(\"${target[@]}\"); fi\nbun x --no-install convex run \"${setup_target[@]}\" billing:setup '{}'\nbun x --no-install static-hosting upload $AUTH_TARGET --no-spa --dist ../../apps/web/dist/client\n"},{name: Report web result,if: always(),run: "node .github/scripts/disposabl.mjs report web,api,mcp ${{ steps.deploy.outcome == 'success' && 'ready' || 'failed' }}"},{name: Expo,if: "needs.changes.outputs.android == 'true'",working-directory: apps/mobile,run: "bash \"$GITHUB_WORKSPACE/.github/scripts/mobile.sh\" expo-env"},{name: Channel,if: "needs.changes.outputs.android == 'true'",working-directory: apps/mobile,run: "bash \"$GITHUB_WORKSPACE/.github/scripts/mobile.sh\" expo-channel"},{name: Fingerprint,id: fingerprint,if: "needs.changes.outputs.android == 'true'",working-directory: apps/mobile,run: "bash \"$GITHUB_WORKSPACE/.github/scripts/mobile.sh\" expo-fingerprint"},{name: Update,if: "steps.fingerprint.outputs.build == 'false'",env: {TAG: "${{ steps.fingerprint.outputs.tag }}",SHA: "${{ steps.fingerprint.outputs.sha }}",RUNTIME: "${{ steps.fingerprint.outputs.runtime }}"},run: "bash \"$GITHUB_WORKSPACE/.github/scripts/mobile.sh\" expo-update"},&item5 {name: Publish,if: "github.job == 'android' || (github.job == 'web' && hashFiles('dist/release/android.json') != '') || github.job == 'desktop'",shell: bash,run: "bash \"$GITHUB_WORKSPACE/.github/scripts/release.sh\" verify-artifacts"},&item6 {name: Upload release artifacts,id: artifacts,if: "hashFiles('dist/release/*') != ''",uses: actions/upload-artifact@v4,with: {name: "release-${{ env.PLATFORM }}",path: dist/release/,retention-days: 3,compression-level: 0,if-no-files-found: error}}]},android: {name: Android,needs: [changes,web],if: "needs.web.outputs.android_build == 'true'",permissions: *permissions,runs-on: "${{ needs.changes.outputs.android_runner }}",timeout-minutes: 30,env: {PLATFORM: android,EXPO_TOKEN: "${{ secrets.EXPO_TOKEN }}",EXPO_PROJECT_ID: "${{ secrets.EXPO_PROJECT_ID || vars.EXPO_PROJECT_ID }}",EXPO_OWNER: "${{ secrets.EXPO_OWNER || vars.EXPO_OWNER }}",EXPO_SLUG: "${{ secrets.EXPO_SLUG || vars.EXPO_SLUG }}",EXPO_NO_DOTENV: "1",CONVEX_URL: "${{ needs.web.outputs.convex_url }}",CONVEX_SITE_URL: "${{ needs.web.outputs.convex_site_url }}",EXPO_PUBLIC_CONVEX_URL: "${{ needs.web.outputs.convex_url }}",EXPO_PUBLIC_CONVEX_SITE_URL: "${{ needs.web.outputs.convex_site_url }}"},steps: [*item0,{name: Prepare Android disk space,run: bash .github/scripts/android-runner.sh prepare},*item1,*item2,*item3,*item4,{name: Report mobile build,run: "node .github/scripts/disposabl.mjs report \"$PLATFORM\" building"},{name: Expo,working-directory: apps/mobile,run: "bash \"$GITHUB_WORKSPACE/.github/scripts/mobile.sh\" expo-env"},{name: Java,uses: actions/setup-java@v5,with: {distribution: temurin,java-version: "17"}},{name: SDK,uses: android-actions/setup-android@v3,with: {packages: platform-tools}},{name: Gradle,uses: gradle/actions/setup-gradle@v4,with: {cache-read-only: false}},{name: Restore native compiler cache,if: "github.event_name == 'push'",id: native-cache,uses: actions/cache/restore@v4,with: {path: "${{ runner.temp }}/ccache",key: "android-ccache-v1-${{ runner.os }}-${{ runner.arch }}-${{ github.sha }}"}},{name: Install native compiler cache,if: "github.event_name == 'push' && steps.native-cache.outputs.cache-hit == 'true'",run: "sudo apt-get update -qq\nsudo apt-get install -y ccache\nprintf 'CCACHE_DIR=%s\\nCCACHE_COMPILERCHECK=content\\nCMAKE_C_COMPILER_LAUNCHER=ccache\\nCMAKE_CXX_COMPILER_LAUNCHER=ccache\\n' \"$RUNNER_TEMP/ccache\" >> \"$GITHUB_ENV\"\n"},{name: Build,working-directory: apps/mobile,env: {RUNTIME: "${{ needs.web.outputs.android_runtime }}",DISPOSABL_ANDROID_CHANNEL: "${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || 'production' }}",DISPOSABL_ANDROID_SIGNING: "${{ github.event_name == 'push' && secrets.DISPOSABL_ANDROID_SIGNING || '' }}",ANDROID_KEYSTORE_BASE64: "${{ github.event_name == 'push' && secrets.ANDROID_KEYSTORE_BASE64 || '' }}",ANDROID_KEYSTORE_PASSWORD: "${{ github.event_name == 'push' && secrets.ANDROID_KEYSTORE_PASSWORD || '' }}",ANDROID_KEY_ALIAS: "${{ github.event_name == 'push' && secrets.ANDROID_KEY_ALIAS || '' }}",ANDROID_KEY_PASSWORD: "${{ github.event_name == 'push' && secrets.ANDROID_KEY_PASSWORD || '' }}"},run: "bash \"$GITHUB_WORKSPACE/.github/scripts/mobile.sh\" android-build"},*item5,*item6]},android-failure: {name: Report Android failure,needs: android,if: "always() && (needs.android.result == 'failure' || needs.android.result == 'cancelled')",permissions: {contents: read,id-token: write},runs-on: ubuntu-24.04,timeout-minutes: 5,steps: [*item0,*item1,{run: "node .github/scripts/disposabl.mjs report android failed \"Android build failed or was cancelled; check the workflow log.\""}]},ios-preview: {name: iOS simulator preview,needs: [changes,web],if: "github.event_name == 'pull_request' && needs.web.outputs.ios == 'true'",permissions: *permissions,runs-on: "${{ needs.changes.outputs.macos_runner }}",timeout-minutes: 20,env: {EXPO_TOKEN: "${{ secrets.EXPO_TOKEN }}",CONVEX_URL: "${{ needs.web.outputs.convex_url }}",CONVEX_SITE_URL: "${{ needs.web.outputs.convex_site_url }}",EXPO_PUBLIC_CONVEX_URL: "${{ needs.web.outputs.convex_url }}",EXPO_PUBLIC_CONVEX_SITE_URL: "${{ needs.web.outputs.convex_site_url }}",EXPO_PROJECT_ID: "${{ secrets.EXPO_PROJECT_ID || vars.EXPO_PROJECT_ID }}",EXPO_OWNER: "${{ secrets.EXPO_OWNER || vars.EXPO_OWNER }}",EXPO_SLUG: "${{ secrets.EXPO_SLUG || vars.EXPO_SLUG }}",EXPO_NO_DOTENV: "1"},steps: [*item0,*item1,*item2,*item3,*item4,{name: Report build,run: node .github/scripts/disposabl.mjs report ios building},{name: Load Expo environment,if: "env.EXPO_TOKEN != ''",working-directory: apps/mobile,run: "bash \"$GITHUB_WORKSPACE/.github/scripts/mobile.sh\" expo-env"},{name: Verify update channel,if: "env.EXPO_TOKEN != ''",working-directory: apps/mobile,run: "bash \"$GITHUB_WORKSPACE/.github/scripts/mobile.sh\" expo-channel"},{name: Publish compatible iOS preview update,if: "env.EXPO_TOKEN != ''",working-directory: apps/mobile,run: "bash \"$GITHUB_WORKSPACE/.github/scripts/apple.sh\" ota"},{name: Xcode toolchain,run: "xcodebuild -version\nxcrun swift --version\n"},{name: Build simulator archive,working-directory: apps/mobile,run: "bash \"$GITHUB_WORKSPACE/.github/scripts/apple.sh\" simulator"},{uses: actions/upload-artifact@v4,with: {name: ios-simulator,path: dist/apple/ios-simulator.zip,retention-days: 3,compression-level: 0,if-no-files-found: error}},{name: Report simulator archive,run: "echo 'iOS simulator archive is available in this workflow run’s artifacts; it is not a device or TestFlight build.' >> \"$GITHUB_STEP_SUMMARY\"\nnode .github/scripts/disposabl.mjs report ios ready 'Simulator archive available in workflow artifacts.'\n"},{name: Report failure,if: failure() || cancelled(),run: "node .github/scripts/disposabl.mjs report ios failed 'iOS simulator build failed; check the workflow log.'"}]},ios-production: {name: iOS production and TestFlight,needs: [changes,web],if: "github.event_name == 'push' && needs.web.outputs.ios == 'true'",permissions: *permissions,runs-on: "${{ needs.changes.outputs.linux_runner }}",timeout-minutes: 20,env: {EXPO_TOKEN: "${{ secrets.EXPO_TOKEN }}",EXPO_PROJECT_ID: "${{ secrets.EXPO_PROJECT_ID || vars.EXPO_PROJECT_ID }}",EXPO_OWNER: "${{ secrets.EXPO_OWNER || vars.EXPO_OWNER }}",EXPO_SLUG: "${{ secrets.EXPO_SLUG || vars.EXPO_SLUG }}",EXPO_NO_DOTENV: "1",CONVEX_URL: "${{ needs.web.outputs.convex_url }}",CONVEX_SITE_URL: "${{ needs.web.outputs.convex_site_url }}",EXPO_PUBLIC_CONVEX_URL: "${{ needs.web.outputs.convex_url }}",EXPO_PUBLIC_CONVEX_SITE_URL: "${{ needs.web.outputs.convex_site_url }}"},steps: [*item0,*item1,*item2,*item3,*item4,{name: Check Expo connection,id: apple-prerequisites,working-directory: apps/mobile,run: "bash \"$GITHUB_WORKSPACE/.github/scripts/apple.sh\" prerequisites"},{name: Load Expo environment,if: "steps.apple-prerequisites.outputs.ready == 'true'",working-directory: apps/mobile,run: "bash \"$GITHUB_WORKSPACE/.github/scripts/mobile.sh\" expo-env"},{name: Verify update channel,if: "steps.apple-prerequisites.outputs.ready == 'true'",working-directory: apps/mobile,run: "bash \"$GITHUB_WORKSPACE/.github/scripts/mobile.sh\" expo-channel"},{name: Select iOS update or native build,id: ios-plan,if: "steps.apple-prerequisites.outputs.ready == 'true'",working-directory: apps/mobile,run: "bash \"$GITHUB_WORKSPACE/.github/scripts/apple.sh\" ota-plan"},{name: Publish compatible iOS production update,if: "steps.ios-plan.outputs.action == 'update'",working-directory: apps/mobile,env: {RUNTIME: "${{ steps.ios-plan.outputs.runtime }}"},run: "bash \"$GITHUB_WORKSPACE/.github/scripts/apple.sh\" ota"},{name: Build and submit to TestFlight,if: "steps.ios-plan.outputs.action == 'build'",working-directory: apps/mobile,env: {ASC_APP_ID: "${{ secrets.ASC_APP_ID || vars.ASC_APP_ID }}"},run: "bash \"$GITHUB_WORKSPACE/.github/scripts/apple.sh\" production"},{name: Reconcile delivery of the compatible native build,if: "steps.ios-plan.outputs.action == 'update'",working-directory: apps/mobile,env: {BUILD_ID: "${{ steps.ios-plan.outputs.build_id }}",ASC_APP_ID: "${{ secrets.ASC_APP_ID || vars.ASC_APP_ID }}"},run: "bash \"$GITHUB_WORKSPACE/.github/scripts/apple.sh\" deliver"},{name: Report failure,if: failure() || cancelled(),run: "node .github/scripts/disposabl.mjs report ios failed 'iOS update, native build or submission failed; check the workflow log.'"}]},desktop: {needs: web,permissions: *permissions,name: "${{ matrix.platform }}",if: "github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.web.outputs.desktop != '[]' && needs.web.outputs.desktop != ''",strategy: {fail-fast: false,matrix: {include: "${{ fromJSON(needs.web.outputs.desktop) }}"}},runs-on: "${{ matrix.runner }}",timeout-minutes: 20,env: {PLATFORM: "${{ matrix.platform }}",DISPOSABL_RELEASE_VERSION: "1.${{ github.run_number }}.${{ github.run_attempt }}",DISPOSABL_DESKTOP_PLATFORM: "${{ matrix.platform }}",DISPOSABL_DESKTOP_UPDATE_CHANNEL: production,CONVEX_SITE_URL: "${{ needs.web.outputs.convex_site_url }}",electron_config_cache: "${{ github.workspace }}/.cache/electron"},steps: [*item0,*item1,*item2,*item3,*item4,{name: Report desktop build,run: "node .github/scripts/disposabl.mjs report \"$PLATFORM\" building"},{name: Electron,uses: actions/cache@v4,with: {path: .cache/electron,key: "electron-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('bun.lock') }}"}},{name: Packages,if: "matrix.platform == 'linux'",run: "command -v fakeroot && command -v rpmbuild && command -v dpkg-deb || { sudo apt-get update && sudo apt-get install -y fakeroot dpkg rpm; }"},{name: Configure desktop update identity,shell: bash,run: "id=$(node -p \"require('./disposabl.json').desktopId || ''\")\nif [[ ! \"$id\" =~ ^[a-f0-9]{32}$ ]]; then echo 'Desktop identity missing; regenerate this app before its first installation.' >&2; exit 1; fi\necho \"DISPOSABL_DESKTOP_ID=$id\" >> \"$GITHUB_ENV\"\necho \"DISPOSABL_DESKTOP_UPDATE_URL=${CONVEX_SITE_URL}/desktop/updates/$id\" >> \"$GITHUB_ENV\"\n"},{name: Build,if: "matrix.platform != 'macos'",run: bun run --cwd apps/desktop preview},{name: Build macOS,if: "matrix.platform == 'macos'",shell: bash,env: {MACOS_SIGNING_CONFIG: "${{ secrets.MACOS_SIGNING_CONFIG }}"},run: bash .github/scripts/macos-release.sh},*item5,{name: Publish desktop update feed,if: "matrix.platform == 'windows' || (matrix.platform == 'macos' && env.MACOS_NOTARIZE == 'true')",shell: bash,env: {CONVEX_DEPLOY_KEY: "${{ secrets.CONVEX_DEPLOY_KEY }}"},run: "test \"$(gh api \"repos/$GH_REPO/git/ref/heads/main\" --jq .object.sha)\" = \"$SOURCE\"\nnode apps/desktop/publish-update.mjs\n"},{name: Upload desktop release artifacts,if: "matrix.platform != 'macos' || env.MACOS_NOTARIZE == 'true'",uses: actions/upload-artifact@v4,with: {name: "release-${{ env.PLATFORM }}",path: dist/release/,retention-days: 3,compression-level: 0,if-no-files-found: error}},{name: Upload staged update feed,if: "matrix.platform != 'linux' && env.DISPOSABL_DESKTOP_UPDATE_URL != '' && (matrix.platform != 'macos' || env.MACOS_NOTARIZE == 'true')",uses: actions/upload-artifact@v4,with: {name: "desktop-update-${{ env.PLATFORM }}",path: dist/update/,retention-days: 3,if-no-files-found: error}},{name: Upload unsigned macOS artifact,if: "matrix.platform == 'macos' && env.MACOS_NOTARIZE != 'true'",uses: actions/upload-artifact@v4,with: {name: macos-unsigned,path: "dist/release/*.dmg\ndist/release/*.zip\n",retention-days: 3,compression-level: 0,if-no-files-found: error}},{name: Report macOS artifact,if: "matrix.platform == 'macos' && env.MACOS_NOTARIZE != 'true'",run: "echo 'macOS DMG is ad-hoc signed, not Developer ID signed or notarized. Download it from this workflow run’s artifacts.' >> \"$GITHUB_STEP_SUMMARY\"\nnode .github/scripts/disposabl.mjs report macos blocked 'Ad-hoc signed DMG available in workflow artifacts; Developer ID signing and notarization are not configured.'\n"},{name: Report desktop failure,if: failure() || cancelled(),run: "node .github/scripts/disposabl.mjs report \"$PLATFORM\" failed"},{name: Clean up macOS signing,if: "always() && matrix.platform == 'macos'",shell: bash,run: bash .github/scripts/macos-release.sh cleanup}]},packages: {name: "Package / ${{ matrix.package }}",needs: [changes,web],if: "github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.web.outputs.packages != '[]' && needs.web.outputs.packages != ''",runs-on: "${{ needs.changes.outputs.linux_runner }}",timeout-minutes: 15,permissions: {contents: write,id-token: write},concurrency: {group: "npm-${{ matrix.package }}",cancel-in-progress: false},strategy: {fail-fast: false,matrix: {package: "${{ fromJSON(needs.web.outputs.packages) }}"}},env: {PACKAGE: "${{ matrix.package }}"},steps: [{uses: actions/checkout@v6,with: {fetch-depth: 0,persist-credentials: false}},*item1,*item2,*item3,*item4,{name: Disposabl GitHub App token,run: node .github/scripts/disposabl.mjs token},{name: Publish package if configured,run: bash .github/scripts/release.sh package-release}]},publish: {needs: [changes,web,android,desktop],if: "always() && !cancelled() && needs.web.result == 'success' && (needs.web.outputs.release == 'true' || needs.android.result == 'success' || needs.desktop.result == 'success')",environment: publishing,runs-on: "${{ needs.changes.outputs.linux_runner }}",timeout-minutes: 15,permissions: {contents: write,actions: read,id-token: write},steps: [{uses: actions/checkout@v6,with: {ref: main,persist-credentials: false}},{uses: actions/setup-node@v6,with: {node-version: "24",package-manager-cache: false}},{name: Disposabl installation token,run: node .github/scripts/disposabl.mjs token},{name: Select release source,id: source,run: bash .github/scripts/release.sh release-source},{uses: actions/download-artifact@v4,if: "steps.source.outputs.current == 'true'",with: {pattern: release-*,path: artifacts}},{name: Publish verified build artifacts,if: "steps.source.outputs.current == 'true'",run: bash .github/scripts/release.sh release-publish}]}}}
@@ -6,7 +6,9 @@
6
6
  "build": {
7
7
  "ios-preview": {
8
8
  "developmentClient": false,
9
- "ios": { "simulator": true },
9
+ "ios": {
10
+ "simulator": true
11
+ },
10
12
  "environment": "preview",
11
13
  "credentialsSource": "remote",
12
14
  "channel": "preview"
@@ -23,19 +23,31 @@ function run(command, args, options = {}) {
23
23
  const packageId = required("PLAY_PACKAGE_ID");
24
24
  if (!/^[a-zA-Z][a-zA-Z0-9_]*(\.[a-zA-Z][a-zA-Z0-9_]*)+$/.test(packageId))
25
25
  throw new Error("Invalid Play package ID");
26
- const expectedCert = required("PLAY_UPLOAD_CERT_SHA256")
27
- .replaceAll(":", "")
28
- .toUpperCase();
29
- if (!/^[0-9A-F]{64}$/.test(expectedCert))
26
+ const rawPlayCert = env.PLAY_UPLOAD_CERT_SHA256 || "";
27
+ const playCert = rawPlayCert.replaceAll(":", "").toUpperCase();
28
+ if (
29
+ rawPlayCert &&
30
+ !/^(?:[0-9a-fA-F]{64}|[0-9a-fA-F]{2}(?::[0-9a-fA-F]{2}){31})$/.test(
31
+ rawPlayCert,
32
+ )
33
+ )
30
34
  throw new Error("Invalid upload certificate SHA256");
31
- const version = required("DISPOSABL_ANDROID_VERSION_CODE");
32
- const previous = required("PLAY_PREVIOUS_VERSION_CODE");
35
+ const rawPlayCertSha1 = env.PLAY_UPLOAD_CERT_SHA1 || "";
33
36
  if (
34
- !/^[1-9]\d*$/.test(version) ||
35
- !/^(0|[1-9]\d*)$/.test(previous) ||
36
- Number(version) > 2100000000 ||
37
- BigInt(version) <= BigInt(previous)
37
+ rawPlayCertSha1 &&
38
+ !/^(?:[0-9a-fA-F]{40}|[0-9a-fA-F]{2}(?::[0-9a-fA-F]{2}){19})$/.test(
39
+ rawPlayCertSha1,
40
+ )
38
41
  )
42
+ throw new Error("Invalid upload certificate SHA1");
43
+ const playCertSha1 = rawPlayCertSha1.replaceAll(":", "").toUpperCase();
44
+ const version = required("DISPOSABL_ANDROID_VERSION_CODE");
45
+ const previous = env.PLAY_PREVIOUS_VERSION_CODE || "";
46
+ if (!/^[1-9]\d*$/.test(version) || BigInt(version) > 2100000000n)
47
+ throw new Error("Invalid candidate version code");
48
+ if (previous && !/^(0|[1-9]\d*)$/.test(previous))
49
+ throw new Error("Invalid previous Play version code");
50
+ if (previous && BigInt(version) <= BigInt(previous))
39
51
  throw new Error(
40
52
  "Version code must be greater than the verified Play version code",
41
53
  );
@@ -80,7 +92,21 @@ const keyInfo = run(
80
92
  ],
81
93
  { env: { ...env, LANG: "C", LC_ALL: "C" } },
82
94
  );
83
- if (fingerprint(keyInfo) !== expectedCert)
95
+ const signingCert = fingerprint(keyInfo);
96
+ if (playCertSha1) {
97
+ const values = [
98
+ ...keyInfo.matchAll(
99
+ /^\s*SHA1:\s*((?:[0-9a-fA-F]{2}:){19}[0-9a-fA-F]{2})\s*$/gm,
100
+ ),
101
+ ];
102
+ if (values.length !== 1)
103
+ throw new Error("Expected exactly one SHA1 certificate fingerprint");
104
+ if (values[0][1].replaceAll(":", "").toUpperCase() !== playCertSha1)
105
+ throw new Error(
106
+ "Keystore certificate SHA1 does not match supplied Play upload certificate",
107
+ );
108
+ }
109
+ if (playCert && signingCert !== playCert)
84
110
  throw new Error(
85
111
  "Keystore certificate does not match verified Play upload certificate",
86
112
  );
@@ -92,7 +118,7 @@ if (
92
118
  String(config.android?.versionCode) !== version
93
119
  )
94
120
  throw new Error(
95
- "Expo package or version does not match verified Play identity",
121
+ "Expo package or candidate version does not match requested inputs",
96
122
  );
97
123
  const architectures = config.extra?.disposablAndroidArchitectures;
98
124
  if (
@@ -127,7 +153,7 @@ if (
127
153
  !gradle.includes(`versionCode ${version}\n`)
128
154
  )
129
155
  throw new Error(
130
- "Fresh Android project does not match verified Play identity",
156
+ "Fresh Android project does not match requested package and candidate version",
131
157
  );
132
158
  run(
133
159
  "./gradlew",
@@ -169,8 +195,28 @@ const verified = verifyBundle({
169
195
  packageId,
170
196
  version,
171
197
  architectures,
172
- expectedCert,
198
+ expectedCert: signingCert,
173
199
  bundletool: required("BUNDLETOOL_JAR"),
174
200
  production: true,
175
201
  });
176
- console.log(JSON.stringify(verified, null, 2));
202
+ const { uploadCertificateSha256: _certificate, ...bundleResult } = verified;
203
+ console.log(
204
+ JSON.stringify(
205
+ {
206
+ ...bundleResult,
207
+ signingCertificateSha256: signingCert,
208
+ signingCertificateSource: "selected keystore",
209
+ playUploadCertificate: playCert
210
+ ? "matched supplied fingerprint"
211
+ : "unchecked",
212
+ playUploadCertificateSha1: playCertSha1
213
+ ? "matched supplied fingerprint"
214
+ : "unchecked",
215
+ playPreviousVersion: previous
216
+ ? "checked against supplied version"
217
+ : "unchecked",
218
+ },
219
+ null,
220
+ 2,
221
+ ),
222
+ );
@@ -64,7 +64,7 @@ export function verifyBundle({
64
64
  expectedCert
65
65
  )
66
66
  throw new Error(
67
- "Bundle signer does not match verified Play upload certificate",
67
+ "Bundle signer does not match expected signing certificate",
68
68
  );
69
69
  return {
70
70
  bundle,
@@ -39,7 +39,7 @@ function ApiKeys() {
39
39
  className="flex gap-2"
40
40
  onSubmit={async (event) => {
41
41
  event.preventDefault();
42
- if (pending) return;
42
+ if (pending || !name.trim() || key) return;
43
43
  setPending(true);
44
44
  setError(undefined);
45
45
  try {
@@ -130,6 +130,7 @@ function ApiKeys() {
130
130
  variant="outline"
131
131
  disabled={pending}
132
132
  onClick={async () => {
133
+ if (pending) return;
133
134
  setPending(true);
134
135
  setError(undefined);
135
136
  try {
@@ -113,6 +113,8 @@ export function createTelemetryLeaseController(options: {
113
113
  signal: controller.signal,
114
114
  },
115
115
  );
116
+ if (epoch !== generation) return;
117
+ if (response.status === 401) anonymousId = undefined;
116
118
  retryable = response.status === 429 || response.status >= 500;
117
119
  if (!response.ok || response.status !== 200)
118
120
  throw new Error("bootstrap unavailable");
@@ -147,10 +149,15 @@ export function createTelemetryLeaseController(options: {
147
149
  if (unchanged && options.adapter.renew) {
148
150
  options.adapter.renew(bounded);
149
151
  } else {
150
- if (active) options.adapter.stop();
152
+ if (active) {
153
+ active = false;
154
+ options.adapter.stop();
155
+ if (epoch !== generation) return;
156
+ }
151
157
  active = true;
152
158
  options.adapter.start(bounded);
153
159
  }
160
+ if (epoch !== generation) return;
154
161
  failures = 0;
155
162
  activeLease = bounded;
156
163
  anonymousId = lease.anonymousId;
@@ -60,7 +60,14 @@ const portal = makeFunctionReference<
60
60
  { url: string }
61
61
  >("billing:portal");
62
62
 
63
- export function Pricing() {
63
+ export type BillingAttempt =
64
+ | "billing_monthly_checkout_attempt"
65
+ | "billing_topup_checkout_attempt"
66
+ | "billing_portal_attempt";
67
+
68
+ export function Pricing({
69
+ onAttempt,
70
+ }: { onAttempt?: (attempt: BillingAttempt) => void } = {}) {
64
71
  if (!paymentsEnabled)
65
72
  return (
66
73
  <section className="mx-auto max-w-5xl p-8">
@@ -68,13 +75,23 @@ export function Pricing() {
68
75
  <SubscriptionHelp />
69
76
  </section>
70
77
  );
71
- return <SessionPricing />;
78
+ return <SessionPricing onAttempt={onAttempt} />;
72
79
  }
73
- function SessionPricing() {
80
+ function SessionPricing({
81
+ onAttempt,
82
+ }: {
83
+ onAttempt?: (attempt: BillingAttempt) => void;
84
+ }) {
74
85
  const token = useAuthToken();
75
86
  const { isAuthenticated, isLoading } = useConvexAuth();
76
87
  const session = !isLoading && isAuthenticated ? sessionId(token) : null;
77
- return <PurchasePage key={session ?? "signed-out"} session={session} />;
88
+ return (
89
+ <PurchasePage
90
+ key={session ?? "signed-out"}
91
+ session={session}
92
+ onAttempt={onAttempt}
93
+ />
94
+ );
78
95
  }
79
96
  function SubscriptionHelp() {
80
97
  return (
@@ -99,7 +116,13 @@ function SubscriptionHelp() {
99
116
  </p>
100
117
  );
101
118
  }
102
- function PurchasePage({ session }: { session: string | null }) {
119
+ function PurchasePage({
120
+ session,
121
+ onAttempt,
122
+ }: {
123
+ session: string | null;
124
+ onAttempt?: (attempt: BillingAttempt) => void;
125
+ }) {
103
126
  const identity = useConsentIdentity();
104
127
  const [{ handoff, fromIos }] = useState(() =>
105
128
  typeof window === "undefined"
@@ -130,6 +153,7 @@ function PurchasePage({ session }: { session: string | null }) {
130
153
  const [message, setMessage] = useState("");
131
154
  const [refreshError, setRefreshError] = useState("");
132
155
  const [busy, setBusy] = useState(false);
156
+ const inFlight = useRef(false);
133
157
  const generation = useRef(0);
134
158
  const refreshSequence = useRef(0);
135
159
  useLayoutEffect(() => {
@@ -172,12 +196,24 @@ function PurchasePage({ session }: { session: string | null }) {
172
196
  !session ||
173
197
  !customerId ||
174
198
  busy ||
199
+ inFlight.current ||
200
+ (kind === "monthly" && hasMonthlyPlan !== false) ||
175
201
  !handoffAllows(fromIos, handoff, customerId, kind)
176
202
  )
177
203
  return;
178
204
  const version = generation.current;
205
+ inFlight.current = true;
179
206
  setBusy(true);
180
207
  setMessage("");
208
+ try {
209
+ onAttempt?.(
210
+ kind === "monthly"
211
+ ? "billing_monthly_checkout_attempt"
212
+ : "billing_topup_checkout_attempt",
213
+ );
214
+ } catch {
215
+ /* Reporting must not interrupt checkout. */
216
+ }
181
217
  try {
182
218
  const result = await requestCheckout(
183
219
  localStorage,
@@ -205,19 +241,29 @@ function PurchasePage({ session }: { session: string | null }) {
205
241
  );
206
242
  await refresh();
207
243
  } finally {
208
- if (version === generation.current) setBusy(false);
244
+ if (version === generation.current) {
245
+ inFlight.current = false;
246
+ setBusy(false);
247
+ }
209
248
  }
210
249
  }
211
250
  async function manage() {
212
- if (!session || busy) return;
251
+ if (!session || busy || inFlight.current) return;
213
252
  const version = generation.current;
253
+ inFlight.current = true;
214
254
  setBusy(true);
255
+ try {
256
+ onAttempt?.("billing_portal_attempt");
257
+ } catch {
258
+ /* Reporting must not interrupt billing. */
259
+ }
215
260
  try {
216
261
  const result = await openPortal({});
217
262
  if (version === generation.current) window.location.assign(result.url);
218
263
  } catch {
219
264
  if (version !== generation.current) return;
220
265
  setMessage("Unable to open billing settings. Please try again.");
266
+ inFlight.current = false;
221
267
  setBusy(false);
222
268
  }
223
269
  }
@@ -20,7 +20,7 @@ const workflow = JSON.parse(
20
20
  ),
21
21
  );
22
22
 
23
- test("Android uses its selected runner while retaining the twenty-minute limit", () => {
23
+ test("Android uses its selected runner while allowing native build and cache finalization", () => {
24
24
  assert.equal(
25
25
  workflow.jobs.changes.outputs.android_runner,
26
26
  "${{ steps.platforms.outputs.android_runner }}",
@@ -29,7 +29,7 @@ test("Android uses its selected runner while retaining the twenty-minute limit",
29
29
  workflow.jobs.android["runs-on"],
30
30
  "${{ needs.changes.outputs.android_runner }}",
31
31
  );
32
- assert.equal(workflow.jobs.android["timeout-minutes"], 20);
32
+ assert.equal(workflow.jobs.android["timeout-minutes"], 30);
33
33
  assert.equal(
34
34
  workflow.jobs.web["runs-on"],
35
35
  "${{ needs.changes.outputs.linux_runner }}",
@@ -38,10 +38,16 @@ test("Android uses its selected runner while retaining the twenty-minute limit",
38
38
 
39
39
  test("Android failure reporting handles failed and cancelled builds independently", () => {
40
40
  const job = workflow.jobs["android-failure"];
41
- assert.equal(job.needs, "android");
41
+ const hasPlayJob = !!workflow.jobs["android-play"];
42
+ assert.deepEqual(
43
+ job.needs,
44
+ hasPlayJob ? ["android", "android-play"] : "android",
45
+ );
42
46
  assert.equal(
43
47
  job.if,
44
- "always() && (needs.android.result == 'failure' || needs.android.result == 'cancelled')",
48
+ hasPlayJob
49
+ ? "always() && (needs.android.result == 'failure' || needs.android.result == 'cancelled' || needs.android-play.result == 'failure' || needs.android-play.result == 'cancelled')"
50
+ : "always() && (needs.android.result == 'failure' || needs.android.result == 'cancelled')",
45
51
  );
46
52
  assert.deepEqual(job.permissions, { contents: "read", "id-token": "write" });
47
53
  assert.equal(job["runs-on"], "ubuntu-24.04");
@@ -1,6 +1,6 @@
1
1
  import { test } from "node:test";
2
2
  import assert from "node:assert/strict";
3
- import { execFile } from "node:child_process";
3
+ import { execFile, execFileSync } from "node:child_process";
4
4
  import { mkdtemp, mkdir, readFile, rm, writeFile } from "node:fs/promises";
5
5
  import { tmpdir } from "node:os";
6
6
  import { join, resolve } from "node:path";
@@ -35,11 +35,22 @@ test("CI uses the deployed target, runs setup before upload and stops on setup f
35
35
  join(root, ".github/workflows/pipeline.yml"),
36
36
  "utf8",
37
37
  );
38
- const deploy = workflow
39
- .match(
40
- / - name: Deploy\n[\s\S]*? run: \|\n((?: .*\n)+)/,
41
- )?.[1]
42
- .replace(/^ {10}/gm, "");
38
+ const parsed = JSON.parse(
39
+ execFileSync(
40
+ process.execPath,
41
+ [
42
+ "-e",
43
+ "console.log(JSON.stringify(Bun.YAML.parse(await Bun.stdin.text())))",
44
+ ],
45
+ { input: workflow, encoding: "utf8" },
46
+ ),
47
+ ) as {
48
+ jobs: { web: { steps: Array<{ name?: string; run?: string }> } };
49
+ };
50
+ const deploy = parsed.jobs.web.steps.find(
51
+ (step) => step.name === "Deploy",
52
+ )?.run;
53
+ assert.equal(typeof deploy, "string");
43
54
  assert.ok(deploy);
44
55
  const temp = await mkdtemp(join(tmpdir(), "billing-deploy-hook-"));
45
56
  try {
@@ -0,0 +1,121 @@
1
+ import { test } from "node:test";
2
+ import assert from "node:assert/strict";
3
+ import { spawnSync } from "node:child_process";
4
+ import {
5
+ copyFileSync,
6
+ mkdirSync,
7
+ mkdtempSync,
8
+ readFileSync,
9
+ rmSync,
10
+ writeFileSync,
11
+ } from "node:fs";
12
+ import { tmpdir } from "node:os";
13
+ import { join } from "node:path";
14
+
15
+ function release(options: {
16
+ prepared?: string;
17
+ available?: string;
18
+ failure?: boolean;
19
+ }) {
20
+ const directory = mkdtempSync(join(tmpdir(), "package-release-"));
21
+ try {
22
+ const bin = join(directory, "bin");
23
+ mkdirSync(bin);
24
+ mkdirSync(join(directory, "packages/sdk"), { recursive: true });
25
+ writeFileSync(
26
+ join(directory, "packages/sdk/package.json"),
27
+ JSON.stringify({ name: "@fixture/sdk", version: "1.0.0-development" }),
28
+ );
29
+ copyFileSync(
30
+ new URL("../../.github/scripts/release.sh", import.meta.url),
31
+ join(directory, "release.sh"),
32
+ );
33
+ const executable = (name: string, body: string) =>
34
+ writeFileSync(join(bin, name), `#!/bin/bash\nset -eu\n${body}\n`, {
35
+ mode: 0o755,
36
+ });
37
+ executable(
38
+ "bun",
39
+ `if [[ "$*" == 'run --cwd packages/sdk release' ]]; then
40
+ echo release >> calls
41
+ [[ "$FAIL_RELEASE" != true ]] || exit 1
42
+ if [[ -n "$PREPARED" ]]; then
43
+ printf '{"name":"@fixture/sdk","version":"%s"}' "$PREPARED" > packages/sdk/package.json
44
+ fi
45
+ fi`,
46
+ );
47
+ executable(
48
+ "npm",
49
+ `echo "npm $*" >> calls
50
+ [[ -n "$AVAILABLE" ]] || { echo 'E404 or registry unavailable' >&2; exit 1; }
51
+ printf '%s\\n' "$AVAILABLE"`,
52
+ );
53
+ executable(
54
+ "node",
55
+ `if [[ "$1" == -p ]]; then
56
+ if [[ "$2" == *.name ]]; then echo '@fixture/sdk';
57
+ else sed -E 's/.*"version":"([^"]+)".*/\\1/' packages/sdk/package.json; fi
58
+ else
59
+ printf '%s version=%s\\n' "$*" "$PUBLISHED_VERSION" >> calls
60
+ fi`,
61
+ );
62
+ const result = spawnSync("/bin/bash", ["release.sh", "package-release"], {
63
+ cwd: directory,
64
+ encoding: "utf8",
65
+ env: {
66
+ PATH: `${bin}:/usr/bin:/bin`,
67
+ NODE_ENV: "test",
68
+ PACKAGE: "sdk",
69
+ PUBLISHED_VERSION: "",
70
+ GH_TOKEN: "fixture-github-token",
71
+ PREPARED: options.prepared ?? "",
72
+ AVAILABLE: options.available ?? "",
73
+ FAIL_RELEASE: String(options.failure ?? false),
74
+ },
75
+ });
76
+ return { ...result, calls: readFileSync(join(directory, "calls"), "utf8") };
77
+ } finally {
78
+ rmSync(directory, { recursive: true, force: true });
79
+ }
80
+ }
81
+
82
+ test("first publication runs before any registry lookup", () => {
83
+ const result = release({ prepared: "1.0.0", available: "1.0.0" });
84
+ assert.equal(result.status, 0, result.stderr);
85
+ assert.ok(
86
+ result.calls.indexOf("release\n") < result.calls.indexOf("npm view"),
87
+ );
88
+ assert.match(result.calls, /npm view @fixture\/sdk@1\.0\.0 version/);
89
+ assert.match(result.calls, /report typescript-sdk ready version=1\.0\.0/);
90
+ });
91
+
92
+ test("no new release reports the existing public version", () => {
93
+ const result = release({ available: "1.2.3" });
94
+ assert.equal(result.status, 0, result.stderr);
95
+ assert.match(result.calls, /npm view @fixture\/sdk version/);
96
+ assert.match(result.calls, /ready version=1\.2\.3/);
97
+ });
98
+
99
+ test("release authorization failure is a failed job, not a successful skip", () => {
100
+ const result = release({ failure: true });
101
+ assert.equal(result.status, 1);
102
+ assert.match(result.calls, /report typescript-sdk failed/);
103
+ assert.doesNotMatch(result.calls, /npm view| ready /);
104
+ });
105
+
106
+ test("unavailable registry or no public version cannot report ready", () => {
107
+ for (const prepared of [undefined, "1.0.0"]) {
108
+ const result = release({ prepared });
109
+ assert.equal(result.status, 1);
110
+ assert.match(result.calls, /release\n/);
111
+ assert.match(result.calls, /availability could not be verified/);
112
+ assert.doesNotMatch(result.calls, / ready /);
113
+ }
114
+ });
115
+
116
+ test("a mismatched registry version cannot report ready", () => {
117
+ const result = release({ prepared: "1.0.0", available: "0.9.0" });
118
+ assert.equal(result.status, 1);
119
+ assert.match(result.calls, /no matching published version/);
120
+ assert.doesNotMatch(result.calls, / ready /);
121
+ });
@@ -90,6 +90,28 @@ test("anonymous identity is forwarded for login but never reused across logout",
90
90
  control.stop();
91
91
  });
92
92
 
93
+ test("unauthorized bootstrap clears in-memory anonymous linkage", async () => {
94
+ const bodies: unknown[] = [];
95
+ const control = createTelemetryLeaseController({
96
+ origin: "http://local",
97
+ transport: async (_url, init) => {
98
+ bodies.push(JSON.parse(String(init?.body)));
99
+ return bodies.length === 2
100
+ ? new Response(null, { status: 401 })
101
+ : reply();
102
+ },
103
+ adapter: { start() {}, stop() {} },
104
+ });
105
+ control.update({ enabled: true, token: null });
106
+ await tick();
107
+ control.update({ enabled: true, token: token("account") });
108
+ await tick();
109
+ control.update({ enabled: true, token: token("account") });
110
+ await tick();
111
+ assert.deepEqual(bodies, [{}, { anonymousId: id }, {}]);
112
+ control.stop();
113
+ });
114
+
93
115
  test("disabled, malformed and unapproved bootstrap replies never start SDK", async () => {
94
116
  for (const response of [
95
117
  new Response(null, { status: 204 }),
@@ -244,6 +266,30 @@ test("a changed server identity restarts even during a same-session refresh", as
244
266
  control.stop();
245
267
  });
246
268
 
269
+ test("a reentrant opt-out while replacing an adapter cannot restart it", async () => {
270
+ let calls = 0;
271
+ const events: string[] = [];
272
+ let control!: ReturnType<typeof createTelemetryLeaseController>;
273
+ control = createTelemetryLeaseController({
274
+ origin: "http://local",
275
+ transport: async () =>
276
+ reply({ identified: true, distinctId: `identity-${++calls}` }),
277
+ adapter: {
278
+ start: () => events.push("start"),
279
+ stop: () => {
280
+ events.push("stop");
281
+ control.update({ enabled: false, token: token("same") });
282
+ },
283
+ },
284
+ });
285
+ control.update({ enabled: true, token: token("same") + "a" });
286
+ await tick();
287
+ control.update({ enabled: true, token: token("same") + "b" });
288
+ await tick();
289
+ assert.deepEqual(events, ["start", "stop"]);
290
+ control.stop();
291
+ });
292
+
247
293
  test("transient bootstrap failure retries with capture off until a valid lease", async () => {
248
294
  let calls = 0;
249
295
  const events: string[] = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-disposabl-app",
3
- "version": "0.18.1",
3
+ "version": "0.19.0",
4
4
  "description": "Create a Disposabl app",
5
5
  "type": "module",
6
6
  "license": "MIT",