@sprid/release 0.1.2 → 1.1.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 +14 -0
- package/README.md +11 -0
- package/package.json +1 -1
- package/src/annotate.ts +1 -1
- package/src/build/ios.ts +74 -24
- package/src/config.ts +8 -0
- package/src/ship.ts +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,20 @@
|
|
|
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.1.0 - 2026-10-05
|
|
7
|
+
|
|
8
|
+
- `build.iosSigning: 'cloud'` signs the App Store build with Apple's cloud-managed
|
|
9
|
+
distribution certificate, which Apple renews itself. The build still runs locally;
|
|
10
|
+
`ship` sets automatic signing on the app and every `build.iosExtensions` target and
|
|
11
|
+
passes the ASC key to `xcodebuild`. No .p12, no profile files and no iOS
|
|
12
|
+
credentials are read. The ASC key needs the Admin role.
|
|
13
|
+
- In cloud mode `ship` warns when the keychain holds a distribution identity, because
|
|
14
|
+
Xcode signs with a local identity before the cloud certificate.
|
|
15
|
+
|
|
16
|
+
## 1.0.0 - 2026-09-30
|
|
17
|
+
|
|
18
|
+
- Breaking: saved Sprid workspace identifiers use UUID strings for release annotations.
|
|
19
|
+
|
|
6
20
|
## 0.1.2 - 2026-09-24
|
|
7
21
|
|
|
8
22
|
- `credentials-push` and `credentials-pull` keep signing keys on EAS (Expo)
|
package/README.md
CHANGED
|
@@ -143,6 +143,17 @@ Commands run in `appDir`; artifact paths resolve beside the release config. The
|
|
|
143
143
|
command must produce a correctly signed IPA or AAB. Direct upload commands bypass
|
|
144
144
|
all build/version assumptions.
|
|
145
145
|
|
|
146
|
+
### Cloud signing
|
|
147
|
+
|
|
148
|
+
`build.iosSigning: 'cloud'` lets Apple sign the App Store build with its
|
|
149
|
+
cloud-managed distribution certificate, which Apple renews itself. The build
|
|
150
|
+
still runs on your Mac; only the distribution key stays with Apple. No .p12, no
|
|
151
|
+
profile files and no iOS credentials.json: `ship` switches every signed target
|
|
152
|
+
(the app and `build.iosExtensions`) to automatic signing and passes the ASC key
|
|
153
|
+
to `xcodebuild`, which issues the profiles from each App ID's capabilities. The
|
|
154
|
+
ASC key must hold the Admin role, since Apple grants no lower role the cloud
|
|
155
|
+
certificate. Android signing is unchanged.
|
|
156
|
+
|
|
146
157
|
### Signing keys on EAS
|
|
147
158
|
|
|
148
159
|
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": "
|
|
3
|
+
"version": "1.1.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/annotate.ts
CHANGED
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
|
-
|
|
108
|
-
|
|
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
|
|
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
|
-
...
|
|
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
|
|
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
|
-
|
|
165
|
-
|
|
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. */
|
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
|
|
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);
|