@sprid/release 1.0.0 → 1.2.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/CHANGELOG.md CHANGED
@@ -3,6 +3,23 @@
3
3
  @sprid/release follows semver: a breaking change to a command's arguments, its
4
4
  output shape or its exit codes is a major release.
5
5
 
6
+ ## 1.2.0 - 2026-10-07
7
+
8
+ - `playScreenshots.tablet {glob, dir?, slots?}` uploads a tablet set alongside the
9
+ phone set. One capture fills both of Play's tablet slots (`sevenInch`, `tenInch`)
10
+ unless `slots` narrows it, because Play shows each slot only on tablets of that
11
+ size. Every file is resolved before any slot is emptied.
12
+
13
+ ## 1.1.0 - 2026-10-05
14
+
15
+ - `build.iosSigning: 'cloud'` signs the App Store build with Apple's cloud-managed
16
+ distribution certificate, which Apple renews itself. The build still runs locally;
17
+ `ship` sets automatic signing on the app and every `build.iosExtensions` target and
18
+ passes the ASC key to `xcodebuild`. No .p12, no profile files and no iOS
19
+ credentials are read. The ASC key needs the Admin role.
20
+ - In cloud mode `ship` warns when the keychain holds a distribution identity, because
21
+ Xcode signs with a local identity before the cloud certificate.
22
+
6
23
  ## 1.0.0 - 2026-09-30
7
24
 
8
25
  - Breaking: saved Sprid workspace identifiers use UUID strings for release annotations.
package/README.md CHANGED
@@ -48,9 +48,16 @@ export default defineReleaseConfig({
48
48
  },
49
49
  contact: { contactEmail: "support@example.com", contactWebsite: "https://example.com", defaultLanguage: "en-US" },
50
50
  playGraphics: { icon: './store/icon-512.png', featureGraphic: './store/{lang}/feature-1024x500.png' },
51
+ playScreenshots: {
52
+ dir: './shots', glob: '{lang}/phone_*.jpg',
53
+ tablet: { glob: '{lang}/tablet_*.jpg' }, // one set fills the 7" and 10" slots; `slots: ['tenInch']` narrows it
54
+ },
51
55
  });
52
56
  ```
53
57
 
58
+ Play shows each tablet slot only on tablets of that size, so one tablet capture goes to both
59
+ slots by default. Every screenshot file is resolved before any slot is emptied.
60
+
54
61
  The Play icon is separate from the launcher icon inside the AAB. If `playGraphics.icon`
55
62
  is omitted, execution verifies existing icons (including default-language fallback) before changing graphics.
56
63
 
@@ -143,6 +150,17 @@ Commands run in `appDir`; artifact paths resolve beside the release config. The
143
150
  command must produce a correctly signed IPA or AAB. Direct upload commands bypass
144
151
  all build/version assumptions.
145
152
 
153
+ ### Cloud signing
154
+
155
+ `build.iosSigning: 'cloud'` lets Apple sign the App Store build with its
156
+ cloud-managed distribution certificate, which Apple renews itself. The build
157
+ still runs on your Mac; only the distribution key stays with Apple. No .p12, no
158
+ profile files and no iOS credentials.json: `ship` switches every signed target
159
+ (the app and `build.iosExtensions`) to automatic signing and passes the ASC key
160
+ to `xcodebuild`, which issues the profiles from each App ID's capabilities. The
161
+ ASC key must hold the Admin role, since Apple grants no lower role the cloud
162
+ certificate. Android signing is unchanged.
163
+
146
164
  ### Signing keys on EAS
147
165
 
148
166
  Expo's EAS can hold the signing keys while this package does the building and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sprid/release",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "Build, sign and release mobile apps locally. Store copy, screenshots, binary uploads and review submissions from one app-owned configuration. Dry run by default.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
package/src/build/ios.ts CHANGED
@@ -3,7 +3,7 @@ import { createHash } from 'node:crypto';
3
3
  import { mkdirSync, mkdtempSync, copyFileSync, writeFileSync } from 'node:fs';
4
4
  import { homedir, tmpdir } from 'node:os';
5
5
  import { resolve } from 'node:path';
6
- import { releasePath } from '../config.ts';
6
+ import { ascIssuer, ascKeyId, releasePath, resolveAscKeyPath } from '../config.ts';
7
7
  import type { AppReleaseConfig } from '../config.ts';
8
8
  import { resolveCredentialsJson } from '../config.ts';
9
9
  import type { IosSigning } from './credentials.ts';
@@ -104,17 +104,53 @@ export async function setupIosSigning(config: AppReleaseConfig, signing: IosSign
104
104
  }
105
105
 
106
106
 
107
- export async function patchXcodeprojSigning(config: AppReleaseConfig, ctx: IosSignContext): Promise<void> {
108
- console.log('── Patching Xcode project signing...');
107
+ /**
108
+ * The xcodebuild flags for cloud signing: the ASC key lets Xcode issue its own
109
+ * profiles and ask Apple to sign with the cloud-managed distribution certificate.
110
+ * Apple only grants that certificate to a key with the Admin role.
111
+ */
112
+ function cloudSigningArgs(config: AppReleaseConfig): string[] {
113
+ const keyId = ascKeyId(config);
114
+ const issuer = ascIssuer(config);
115
+ if (!keyId || !issuer) throw new Error('Cloud signing needs asc.keyId and asc.issuer (or ASC_KEY_ID / ASC_ISSUER).');
116
+ return [
117
+ '-allowProvisioningUpdates',
118
+ '-authenticationKeyPath', resolveAscKeyPath(config),
119
+ '-authenticationKeyID', keyId,
120
+ '-authenticationKeyIssuerID', issuer,
121
+ ];
122
+ }
123
+
124
+
125
+ /**
126
+ * Automatic signing prefers a valid distribution identity in the keychain over the
127
+ * cloud certificate, so a leftover .p12 silently decides which certificate signs a
128
+ * "cloud" build, and the build breaks the day that certificate expires.
129
+ */
130
+ async function warnLocalDistributionIdentity(): Promise<void> {
131
+ const identities = await capture('security', ['find-identity', '-v', '-p', 'codesigning']);
132
+ const local = identities.split('\n').filter((l) => /"(Apple|iPhone|iOS) Distribution:/.test(l)).map(quotedName);
133
+ if (!local.length) return;
134
+ console.warn(` ! Cloud signing, but the keychain holds ${local.join(', ')}.`);
135
+ console.warn(' Xcode signs with a local identity before the cloud certificate. Remove it to sign in the cloud.');
136
+ }
137
+
138
+
139
+ /**
140
+ * Pin every signed target's signing. With a context that is manual signing on the
141
+ * installed profiles; without one (cloud signing) it is automatic signing on the
142
+ * team, and Xcode resolves profiles through the ASC key during the archive.
143
+ */
144
+ export async function patchXcodeprojSigning(config: AppReleaseConfig, ctx?: IosSignContext): Promise<void> {
145
+ console.log(`── Patching Xcode project signing (${ctx ? 'manual' : 'cloud'})...`);
109
146
  const name = config.build!.xcodeName;
110
147
  if (!name || !config.appId || !config.appleTeamId) throw new Error('iOS native builds need build.xcodeName, appId and appleTeamId.');
111
148
  const proj = resolve(releasePath(config, '.'), config.build!.appDir, `ios/${name}.xcodeproj`);
112
- // Every signed target, app first. An extension left on automatic signing stops
149
+ // Every signed target, app first. An extension left on the wrong signing stops
113
150
  // the ARCHIVE — Xcode resolves it there, long before exportOptions is read.
114
- const targets = [
115
- { name, profileUuid: ctx.profileUuid },
116
- ...ctx.extensions.map((e) => ({ name: e.target, profileUuid: e.profileUuid })),
117
- ];
151
+ const targets = ctx
152
+ ? [{ name, profileUuid: ctx.profileUuid }, ...ctx.extensions.map((e) => ({ name: e.target, profileUuid: e.profileUuid }))]
153
+ : [{ name }, ...(config.build!.iosExtensions ?? []).map((e) => ({ name: e.target }))];
118
154
  const script = `
119
155
  require 'xcodeproj'
120
156
  require 'json'
@@ -124,21 +160,29 @@ spec.fetch('targets').each do |entry|
124
160
  target = project.targets.find { |t| t.name == entry.fetch('name') }
125
161
  raise "Signing target not found: #{entry.fetch('name')}" if target.nil?
126
162
  target.build_configurations.each do |c|
127
- c.build_settings['CODE_SIGN_STYLE'] = 'Manual'
128
- c.build_settings['CODE_SIGN_IDENTITY'] = spec.fetch('identity')
129
- c.build_settings['PROVISIONING_PROFILE_SPECIFIER'] = entry.fetch('profileUuid')
130
163
  c.build_settings['DEVELOPMENT_TEAM'] = spec.fetch('team')
164
+ if spec['identity']
165
+ c.build_settings['CODE_SIGN_STYLE'] = 'Manual'
166
+ c.build_settings['CODE_SIGN_IDENTITY'] = spec.fetch('identity')
167
+ c.build_settings['PROVISIONING_PROFILE_SPECIFIER'] = entry.fetch('profileUuid')
168
+ else
169
+ c.build_settings['CODE_SIGN_STYLE'] = 'Automatic'
170
+ c.build_settings['CODE_SIGN_IDENTITY'] = 'Apple Development'
171
+ c.build_settings.delete('PROVISIONING_PROFILE_SPECIFIER')
172
+ c.build_settings.delete('PROVISIONING_PROFILE')
173
+ end
131
174
  end
132
175
  end
133
176
  project.save
134
177
  `;
135
- await run('ruby', ['-e', script, JSON.stringify({ project: proj, targets, identity: ctx.signIdentity, team: config.appleTeamId })]);
178
+ await run('ruby', ['-e', script, JSON.stringify({ project: proj, targets, identity: ctx?.signIdentity, team: config.appleTeamId })]);
136
179
  }
137
180
 
138
181
 
182
+ /** Archive and export the app. No signing context means cloud signing (`build.iosSigning: 'cloud'`). */
139
183
  export async function buildIosArchive(
140
184
  config: AppReleaseConfig,
141
- ctx: IosSignContext,
185
+ ctx: IosSignContext | undefined,
142
186
  sentryToken: string | undefined,
143
187
  ): Promise<string> {
144
188
  const name = config.build!.xcodeName;
@@ -152,23 +196,19 @@ export async function buildIosArchive(
152
196
 
153
197
  const env = { ...process.env };
154
198
  if (!sentryToken) env.SENTRY_DISABLE_AUTO_UPLOAD = 'true';
199
+ const cloud = ctx ? [] : cloudSigningArgs(config);
200
+ if (!ctx) await warnLocalDistributionIdentity();
155
201
 
156
202
  await stage('ios-archive', 'Building iOS archive', () =>
157
203
  runLogged(
158
204
  'xcodebuild',
159
- ['-workspace', `${name}.xcworkspace`, '-scheme', name, '-configuration', 'Release', '-archivePath', archivePath, 'archive'],
205
+ ['-workspace', `${name}.xcworkspace`, '-scheme', name, '-configuration', 'Release', '-archivePath', archivePath, ...cloud, 'archive'],
160
206
  { cwd: iosDir, env, logFile: stageLogPath('ios-archive', releasePath(config, '.')), surface: XCODE_SURFACE, status: xcodeStatus },
161
207
  ),
162
208
  );
163
209
 
164
- writeFileSync(
165
- exportOptions,
166
- `<?xml version="1.0" encoding="UTF-8"?>
167
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
168
- <plist version="1.0">
169
- <dict>
170
- <key>method</key><string>app-store-connect</string>
171
- <key>teamID</key><string>${xml(config.appleTeamId)}</string>
210
+ const signing = ctx
211
+ ? `
172
212
  <key>signingStyle</key><string>manual</string>
173
213
  <key>provisioningProfiles</key>
174
214
  <dict>
@@ -176,7 +216,17 @@ export async function buildIosArchive(
176
216
  .map((e) => `\n <key>${xml(e.bundleId)}</key><string>${xml(e.profileUuid)}</string>`)
177
217
  .join('')}
178
218
  </dict>
179
- <key>signingCertificate</key><string>${xml(ctx.signIdentity)}</string>
219
+ <key>signingCertificate</key><string>${xml(ctx.signIdentity)}</string>`
220
+ : `
221
+ <key>signingStyle</key><string>automatic</string>`;
222
+ writeFileSync(
223
+ exportOptions,
224
+ `<?xml version="1.0" encoding="UTF-8"?>
225
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
226
+ <plist version="1.0">
227
+ <dict>
228
+ <key>method</key><string>app-store-connect</string>
229
+ <key>teamID</key><string>${xml(config.appleTeamId)}</string>${signing}
180
230
  <key>uploadSymbols</key><false/>
181
231
  <key>destination</key><string>export</string>
182
232
  </dict>
@@ -187,7 +237,7 @@ export async function buildIosArchive(
187
237
  await stage('ios-export', 'Exporting IPA', () =>
188
238
  runLogged(
189
239
  'xcodebuild',
190
- ['-exportArchive', '-archivePath', archivePath, '-exportPath', exportPath, '-exportOptionsPlist', exportOptions],
240
+ ['-exportArchive', '-archivePath', archivePath, '-exportPath', exportPath, '-exportOptionsPlist', exportOptions, ...cloud],
191
241
  { cwd: iosDir, env, logFile: stageLogPath('ios-export', releasePath(config, '.')), surface: XCODE_SURFACE },
192
242
  ),
193
243
  );
package/src/config.ts CHANGED
@@ -120,6 +120,14 @@ export interface BuildConfig {
120
120
  * Omit when the app is a single target, which is the common case.
121
121
  */
122
122
  iosExtensions?: IosExtensionTarget[];
123
+ /**
124
+ * How the App Store build is signed. `'manual'` (default) imports the .p12 from
125
+ * credentials.json and signs with the profile files. `'cloud'` lets Apple sign
126
+ * at export with its cloud-managed distribution certificate, which Apple renews
127
+ * itself: no .p12, no profile files, and `iosExtensions[].profilePath` is
128
+ * ignored. Needs an ASC key (`asc`) with the Admin role.
129
+ */
130
+ iosSigning?: 'manual' | 'cloud';
123
131
  /** Extra gradle -P props for the release bundle (e.g. MAPBOX_DOWNLOADS_TOKEN). */
124
132
  gradleProps?: Record<string, string>;
125
133
  /** Local env files to hide during prebuild so the committed .env wins. */
@@ -232,8 +240,17 @@ export interface PlayScreenshotsConfig {
232
240
  * `{lang}` replaced by the copy-locale key (e.g. `{lang}/aso/app_{lang}_play-phone_*.jpg`).
233
241
  */
234
242
  glob: string;
243
+ /**
244
+ * Optional tablet set. Play keeps separate 7" and 10" slots and shows each only
245
+ * on tablets of that size, so one capture is uploaded to every slot in `slots`
246
+ * (default both). `dir` defaults to the phone `dir`.
247
+ */
248
+ tablet?: { dir?: string; glob: string; slots?: PlayTabletSlot[] };
235
249
  }
236
250
 
251
+ /** Play's tablet screenshot slots (`sevenInchScreenshots`, `tenInchScreenshots`). */
252
+ export type PlayTabletSlot = 'sevenInch' | 'tenInch';
253
+
237
254
  /** App Store screenshot upload source (for the `asc-screenshots` command). */
238
255
  export interface AscScreenshotsConfig {
239
256
  /** Base dir, relative to cwd. */
@@ -1,12 +1,13 @@
1
1
  /**
2
- * Upload Play Store phone screenshots: per listing locale, delete the existing `phoneScreenshots`
3
- * then upload the ordered JPEGs matched by `playScreenshots.{dir,glob}`. Commits
4
- * with `changesNotSentForReview` (+ the draft-app retry).
2
+ * Upload Play Store screenshots: per listing locale, delete the existing `phoneScreenshots`
3
+ * then upload the ordered JPEGs matched by `playScreenshots.{dir,glob}`, and the same for
4
+ * each tablet slot when `playScreenshots.tablet` is set. Every file is resolved before
5
+ * anything is deleted. Commits with `changesNotSentForReview` (+ the draft-app retry).
5
6
  */
6
7
 
7
8
  import { createReadStream, readdirSync } from 'node:fs';
8
9
  import { basename, dirname, resolve } from 'node:path';
9
- import { listingLocaleMap, releasePath, type AppReleaseConfig } from '../config.ts';
10
+ import { listingLocaleMap, releasePath, type AppReleaseConfig, type PlayTabletSlot } from '../config.ts';
10
11
  import { createPlayClient } from './client.ts';
11
12
 
12
13
  export interface PushPlayScreenshotsOptions {
@@ -35,6 +36,9 @@ function filesFor(dir: string, glob: string, lang: string): string[] {
35
36
  .map((n) => resolve(folder, n));
36
37
  }
37
38
 
39
+ type ImageType = 'phoneScreenshots' | 'sevenInchScreenshots' | 'tenInchScreenshots';
40
+ const TABLET_TYPES: Record<PlayTabletSlot, ImageType> = { sevenInch: 'sevenInchScreenshots', tenInch: 'tenInchScreenshots' };
41
+
38
42
  export async function pushPlayScreenshots({ config, localeMap, execute = false }: PushPlayScreenshotsOptions): Promise<void> {
39
43
  const sc = config.playScreenshots;
40
44
  if (!sc) throw new Error('release.config.ts needs `playScreenshots {dir, glob}` for play-screenshots.');
@@ -42,56 +46,67 @@ export async function pushPlayScreenshots({ config, localeMap, execute = false }
42
46
 
43
47
  const map = listingLocaleMap(config, 'play', localeMap);
44
48
  const dir = releasePath(config, sc.dir);
49
+ const tablet = sc.tablet;
50
+ const tabletDir = tablet ? releasePath(config, tablet.dir ?? sc.dir) : '';
51
+ const tabletTypes = tablet ? (tablet.slots ?? ['sevenInch', 'tenInch']).map((slot) => TABLET_TYPES[slot]) : [];
52
+ // locale → image type → ordered files. Resolved up front so a missing set fails
53
+ // before any slot is emptied.
45
54
  const sources = new Map(Object.entries(map).map(([locale, lang]) => {
46
- const files = filesFor(dir, sc.glob, lang);
47
- if (!files.length) throw new Error(`No replacement screenshots for ${locale}: ${sc.glob}`);
48
- return [locale, files];
55
+ const sets: Partial<Record<ImageType, string[]>> = {};
56
+ const phone = filesFor(dir, sc.glob, lang);
57
+ if (!phone.length) throw new Error(`No replacement screenshots for ${locale}: ${sc.glob}`);
58
+ sets.phoneScreenshots = phone;
59
+ if (tablet) {
60
+ const files = filesFor(tabletDir, tablet.glob, lang);
61
+ if (!files.length) throw new Error(`No replacement tablet screenshots for ${locale}: ${tablet.glob}`);
62
+ for (const type of tabletTypes) sets[type] = files;
63
+ }
64
+ return [locale, sets];
49
65
  }));
50
66
  console.log(JSON.stringify(Object.fromEntries(sources), null, 2));
51
- if (!execute) return;
67
+ if (!execute) {
68
+ console.log('\n(dry run — pass execute:true to push)');
69
+ return;
70
+ }
52
71
  const { play, packageName } = createPlayClient(config);
53
72
 
54
- const editRes = execute ? await play.edits.insert({ packageName }) : { data: { id: 'dry-run' } };
55
- const editId = editRes.data.id!;
56
- if (execute) console.log(` Edit ID: ${editId}`);
73
+ const editId = (await play.edits.insert({ packageName })).data.id!;
74
+ console.log(` Edit ID: ${editId}`);
57
75
 
58
76
  try {
59
- for (const [locale, lang] of Object.entries(map)) {
60
- const files = sources.get(locale)!;
61
- console.log(` [${locale}] ${files.length} screenshot(s)${files.length ? '' : ' — skipping'}`);
62
- for (const f of files) console.log(` ${f.split('/').pop()}`);
63
- if (!execute || !files.length) continue;
64
-
65
- await play.edits.images
66
- .deleteall({ packageName, editId, language: locale, imageType: 'phoneScreenshots' })
67
- .catch((e: any) => {
68
- if (e.code !== 404) throw e;
69
- });
70
- for (const f of files) {
71
- await play.edits.images.upload({
72
- packageName,
73
- editId,
74
- language: locale,
75
- imageType: 'phoneScreenshots',
76
- media: { mimeType: f.toLowerCase().endsWith('.png') ? 'image/png' : 'image/jpeg', body: createReadStream(f) },
77
- });
77
+ for (const [locale, sets] of sources) {
78
+ for (const [imageType, files] of Object.entries(sets) as [ImageType, string[]][]) {
79
+ console.log(` [${locale}] ${imageType}: ${files.length} screenshot(s)`);
80
+ for (const f of files) console.log(` ${f.split('/').pop()}`);
81
+ await play.edits.images
82
+ .deleteall({ packageName, editId, language: locale, imageType })
83
+ .catch((e: any) => {
84
+ if (e.code !== 404) throw e;
85
+ });
86
+ for (const f of files) {
87
+ await play.edits.images.upload({
88
+ packageName,
89
+ editId,
90
+ language: locale,
91
+ imageType,
92
+ media: { mimeType: f.toLowerCase().endsWith('.png') ? 'image/png' : 'image/jpeg', body: createReadStream(f) },
93
+ });
94
+ }
78
95
  }
79
96
  }
80
97
 
81
- if (execute) {
82
- try {
83
- await play.edits.commit({ packageName, editId, changesNotSentForReview: true });
84
- } catch (e: any) {
85
- if (String(e?.message ?? '').includes('changesNotSentForReview')) {
86
- await play.edits.commit({ packageName, editId });
87
- } else throw e;
88
- }
89
- console.log(' ✓ committed');
98
+ try {
99
+ await play.edits.commit({ packageName, editId, changesNotSentForReview: true });
100
+ } catch (e: any) {
101
+ if (String(e?.message ?? '').includes('changesNotSentForReview')) {
102
+ await play.edits.commit({ packageName, editId });
103
+ } else throw e;
90
104
  }
105
+ console.log(' ✓ committed');
91
106
  } catch (err) {
92
- if (execute) await play.edits.delete({ packageName, editId }).catch(() => {});
107
+ await play.edits.delete({ packageName, editId }).catch(() => {});
93
108
  throw err;
94
109
  }
95
110
 
96
- console.log(`\n${execute ? '✓ Done' : '(dry run — pass execute:true to push)'}`);
111
+ console.log('\n✓ Done');
97
112
  }
package/src/ship.ts CHANGED
@@ -121,7 +121,9 @@ export async function ship(config: AppReleaseConfig, opts: ShipOptions = {}): Pr
121
121
  // Load configured public settings and allowlisted build secrets before prebuild.
122
122
  exportPublicEnvFromEas(config);
123
123
  loadBuildEnv(config);
124
- const signIos = ios && !config.build.commands?.ios;
124
+ const cloudIos = config.build.iosSigning === 'cloud';
125
+ // Cloud signing needs no iOS signing material at all: Apple holds the key.
126
+ const signIos = ios && !config.build.commands?.ios && !cloudIos;
125
127
  const signAndroid = android && !config.build.commands?.android;
126
128
  let signingConfig = config;
127
129
  if ((signIos || signAndroid) && config.build.credentialsSource === 'eas') {
@@ -156,6 +158,10 @@ export async function ship(config: AppReleaseConfig, opts: ShipOptions = {}): Pr
156
158
  if (ios && config.build.commands?.ios) {
157
159
  ipaPath = await customBuild(config, 'ios');
158
160
  if (upload) await uploadIpa(config, ipaPath);
161
+ } else if (ios && cloudIos) {
162
+ await patchXcodeprojSigning(config);
163
+ ipaPath = await buildIosArchive(config, undefined, sentryToken);
164
+ if (upload) await uploadIpa(config, ipaPath);
159
165
  } else if (ios) {
160
166
  if (!creds.ios) throw new Error('iOS build requested but no ios credentials loaded.');
161
167
  const ctx = await setupIosSigning(config, creds.ios);