git-subtree-dir: apps/mobile git-subtree-mainline:86f8987dffgit-subtree-split:5fa30f365f
65 lines
2.0 KiB
JavaScript
65 lines
2.0 KiB
JavaScript
// @ts-check
|
|
const { withXcodeProject } = require("@expo/config-plugins");
|
|
|
|
const RELEASE_SIGN_KEY = '"CODE_SIGN_IDENTITY[sdk=iphoneos*]"';
|
|
const MAIN_BUNDLE_ID = "com.beenvoice.app";
|
|
const WIDGET_BUNDLE_ID = "com.beenvoice.app.ExpoWidgetsTarget";
|
|
|
|
/**
|
|
* Keep App Store archives on distribution signing. Automatic signing can select
|
|
* an Apple Development identity for the widget target when archiving from the CLI,
|
|
* so both release targets use their explicit App Store profiles instead.
|
|
*/
|
|
function configureReleaseSigning(project) {
|
|
const configurations = project.pbxXCBuildConfigurationSection();
|
|
|
|
for (const key of Object.keys(configurations)) {
|
|
const buildConfig = configurations[key];
|
|
if (
|
|
!buildConfig ||
|
|
typeof buildConfig !== "object" ||
|
|
!buildConfig.buildSettings
|
|
) {
|
|
continue;
|
|
}
|
|
|
|
if (buildConfig.name !== "Release") {
|
|
continue;
|
|
}
|
|
|
|
const bundleId = String(
|
|
buildConfig.buildSettings.PRODUCT_BUNDLE_IDENTIFIER ?? "",
|
|
).replaceAll('"', "");
|
|
if (bundleId !== MAIN_BUNDLE_ID && bundleId !== WIDGET_BUNDLE_ID) {
|
|
continue;
|
|
}
|
|
|
|
const profileName =
|
|
bundleId === WIDGET_BUNDLE_ID
|
|
? (process.env.IOS_WIDGET_APPSTORE_PROFILE_NAME ?? WIDGET_BUNDLE_ID)
|
|
: (process.env.IOS_MAIN_APPSTORE_PROFILE_NAME ?? MAIN_BUNDLE_ID);
|
|
|
|
buildConfig.buildSettings[RELEASE_SIGN_KEY] = '"Apple Distribution"';
|
|
buildConfig.buildSettings.CODE_SIGN_STYLE = "Manual";
|
|
buildConfig.buildSettings.PROVISIONING_PROFILE_SPECIFIER = `"${profileName}"`;
|
|
|
|
if (process.env.APPLE_TEAM_ID) {
|
|
buildConfig.buildSettings.DEVELOPMENT_TEAM = process.env.APPLE_TEAM_ID;
|
|
}
|
|
}
|
|
|
|
return project;
|
|
}
|
|
|
|
/** @type {import('@expo/config-plugins').ConfigPlugin} */
|
|
function withAppStoreSigning(config) {
|
|
return withXcodeProject(config, (config) => {
|
|
configureReleaseSigning(config.modResults);
|
|
|
|
return config;
|
|
});
|
|
}
|
|
|
|
module.exports = withAppStoreSigning;
|
|
module.exports.configureReleaseSigning = configureReleaseSigning;
|