@expo/build-tools 1.0.183 → 1.0.185

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.
Files changed (35) hide show
  1. package/dist/common/fastlane.d.ts +7 -0
  2. package/dist/common/fastlane.js +11 -0
  3. package/dist/common/fastlane.js.map +1 -0
  4. package/dist/common/git.d.ts +10 -0
  5. package/dist/common/git.js +85 -0
  6. package/dist/common/git.js.map +1 -0
  7. package/dist/common/projectSources.js +47 -74
  8. package/dist/common/projectSources.js.map +1 -1
  9. package/dist/context.js +7 -29
  10. package/dist/context.js.map +1 -1
  11. package/dist/customBuildContext.js +6 -5
  12. package/dist/customBuildContext.js.map +1 -1
  13. package/dist/ios/fastlane.js +5 -9
  14. package/dist/ios/fastlane.js.map +1 -1
  15. package/dist/ios/pod.js +2 -1
  16. package/dist/ios/pod.js.map +1 -1
  17. package/dist/steps/easFunctions.js +2 -2
  18. package/dist/steps/easFunctions.js.map +1 -1
  19. package/dist/steps/functionGroups/maestroTest.js +14 -5
  20. package/dist/steps/functionGroups/maestroTest.js.map +1 -1
  21. package/dist/steps/functions/createSubmissionEntity.js +1 -1
  22. package/dist/steps/functions/createSubmissionEntity.js.map +1 -1
  23. package/dist/steps/functions/downloadBuild.d.ts +2 -2
  24. package/dist/steps/functions/downloadBuild.js +5 -5
  25. package/dist/steps/functions/downloadBuild.js.map +1 -1
  26. package/dist/steps/functions/installPods.js +2 -1
  27. package/dist/steps/functions/installPods.js.map +1 -1
  28. package/dist/steps/functions/repack.d.ts +18 -0
  29. package/dist/steps/functions/repack.js +155 -107
  30. package/dist/steps/functions/repack.js.map +1 -1
  31. package/dist/steps/utils/ios/fastlane.js +6 -10
  32. package/dist/steps/utils/ios/fastlane.js.map +1 -1
  33. package/dist/utils/outputs.js +1 -0
  34. package/dist/utils/outputs.js.map +1 -1
  35. package/package.json +5 -5
@@ -3,137 +3,185 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createRepackBuildFunction = void 0;
7
- const path_1 = __importDefault(require("path"));
8
- const util_1 = require("util");
9
- const stream_1 = require("stream");
10
- const os_1 = __importDefault(require("os"));
11
- const assert_1 = __importDefault(require("assert"));
12
- const steps_1 = require("@expo/steps");
13
- const fs_extra_1 = __importDefault(require("fs-extra"));
6
+ exports.resolveIosSigningOptionsAsync = exports.resolveAndroidSigningOptionsAsync = exports.createRepackBuildFunction = void 0;
7
+ const node_crypto_1 = require("node:crypto");
8
+ const node_fs_1 = __importDefault(require("node:fs"));
9
+ const node_os_1 = __importDefault(require("node:os"));
10
+ const node_path_1 = __importDefault(require("node:path"));
14
11
  const eas_build_job_1 = require("@expo/eas-build-job");
15
- const node_fetch_1 = __importDefault(require("node-fetch"));
12
+ const steps_1 = require("@expo/steps");
16
13
  const repack_app_1 = require("@expo/repack-app");
17
- const uuid_1 = require("uuid");
14
+ const fastlane_1 = require("../../common/fastlane");
18
15
  const manager_1 = __importDefault(require("../utils/ios/credentials/manager"));
19
- const pipeline = (0, util_1.promisify)(stream_1.Stream.pipeline);
20
16
  function createRepackBuildFunction() {
21
17
  return new steps_1.BuildFunction({
22
18
  namespace: 'eas',
23
- id: '__download_and_repack_golden_development_client_archive',
24
- name: 'Download and repack golden development client archive',
19
+ id: 'repack',
20
+ name: 'Repack app',
21
+ inputProviders: [
22
+ steps_1.BuildStepInput.createProvider({
23
+ id: 'source_app_path',
24
+ allowedValueTypeName: steps_1.BuildStepInputValueTypeName.STRING,
25
+ required: true,
26
+ }),
27
+ steps_1.BuildStepInput.createProvider({
28
+ id: 'platform',
29
+ required: false,
30
+ allowedValueTypeName: steps_1.BuildStepInputValueTypeName.STRING,
31
+ }),
32
+ steps_1.BuildStepInput.createProvider({
33
+ id: 'output_path',
34
+ allowedValueTypeName: steps_1.BuildStepInputValueTypeName.STRING,
35
+ required: false,
36
+ }),
37
+ steps_1.BuildStepInput.createProvider({
38
+ id: 'embed_bundle_assets',
39
+ allowedValueTypeName: steps_1.BuildStepInputValueTypeName.BOOLEAN,
40
+ required: false,
41
+ }),
42
+ ],
25
43
  outputProviders: [
26
44
  steps_1.BuildStepOutput.createProvider({
27
- id: 'repacked_archive_path',
45
+ id: 'output_path',
28
46
  required: true,
29
47
  }),
30
48
  ],
31
- fn: async (stepsCtx, { outputs, env }) => {
32
- var _a, _b, _c, _d;
33
- const tmpDir = path_1.default.join(os_1.default.tmpdir(), `eas-build-golden-dev-client-app-${(0, uuid_1.v4)()}`);
34
- await fs_extra_1.default.mkdirs(tmpDir);
35
- const workingDirectory = path_1.default.join(tmpDir, 'working-directory');
36
- await fs_extra_1.default.mkdirs(workingDirectory);
37
- stepsCtx.logger.info(`Created temporary directory: ${tmpDir}`);
38
- stepsCtx.logger.info('Downloading golden development client archive...');
39
- const fileName = stepsCtx.global.staticContext.job.platform === eas_build_job_1.Platform.IOS
40
- ? stepsCtx.global.staticContext.job.simulator
41
- ? 'golden-dev-client-simulator-latest.ipa'
42
- : 'golden-dev-client-device-latest.ipa'
43
- : 'golden-dev-client-latest.apk';
44
- const goldenArchiveUrl = (_a = env.__EAS_GOLDEN_DEV_CLIENT_URL) !== null && _a !== void 0 ? _a : `https://storage.googleapis.com/turtle-v2/onboarding/${fileName}`;
45
- const goldenArchivePath = path_1.default.join(tmpDir, fileName);
46
- try {
47
- const response = await (0, node_fetch_1.default)(goldenArchiveUrl, {
48
- timeout: 1 * 60 * 1000, // 1 minute
49
- });
50
- if (!response.ok) {
51
- throw new Error(`[${response.status}] ${response.statusText}`);
52
- }
53
- await pipeline(response.body, fs_extra_1.default.createWriteStream(goldenArchivePath));
54
- }
55
- catch (error) {
56
- throw new Error(`Failed to download golden development client archive: ${error.message}`);
49
+ fn: async (stepsCtx, { inputs, outputs, env }) => {
50
+ var _a, _b;
51
+ const projectRoot = stepsCtx.workingDirectory;
52
+ const verbose = stepsCtx.global.env['EAS_VERBOSE'] === '1';
53
+ const platform = (_a = inputs.platform.value) !== null && _a !== void 0 ? _a : stepsCtx.global.staticContext.job.platform;
54
+ if (![eas_build_job_1.Platform.ANDROID, eas_build_job_1.Platform.IOS].includes(platform)) {
55
+ throw new Error(`Unsupported platform: ${platform}. Platform must be "${eas_build_job_1.Platform.ANDROID}" or "${eas_build_job_1.Platform.IOS}"`);
57
56
  }
58
- stepsCtx.logger.info(`Downloaded golden development client archive to ${goldenArchivePath}`);
59
- stepsCtx.logger.info('Repacking and resigning the app...');
60
- const repackedArchivePath = path_1.default.join(tmpDir, stepsCtx.global.staticContext.job.platform === eas_build_job_1.Platform.IOS
61
- ? stepsCtx.global.staticContext.job.simulator
62
- ? 'target.zip'
63
- : 'target.ipa'
64
- : 'target.apk');
65
- if (stepsCtx.global.staticContext.job.platform === eas_build_job_1.Platform.IOS) {
66
- await (0, repack_app_1.repackAppIosAsync)({
67
- platform: 'ios',
68
- projectRoot: stepsCtx.workingDirectory,
69
- sourceAppPath: goldenArchivePath,
70
- outputPath: repackedArchivePath,
71
- workingDirectory,
72
- iosSigningOptions: stepsCtx.global.staticContext.job.simulator
73
- ? undefined
74
- : await resolveIosSigningOptions({
57
+ const repackSpawnAsync = createSpawnAsyncStepAdapter({ verbose, logger: stepsCtx.logger });
58
+ const tmpDir = await node_fs_1.default.promises.mkdtemp(node_path_1.default.join(node_os_1.default.tmpdir(), `repack-`));
59
+ const workingDirectory = node_path_1.default.join(tmpDir, 'working-directory');
60
+ await node_fs_1.default.promises.mkdir(workingDirectory);
61
+ stepsCtx.logger.info(`Created temporary working directory: ${workingDirectory}`);
62
+ const sourceAppPath = inputs.source_app_path.value;
63
+ const outputPath = (_b = inputs.output_path.value) !== null && _b !== void 0 ? _b : node_path_1.default.join(tmpDir, `repacked-${(0, node_crypto_1.randomUUID)()}${node_path_1.default.extname(sourceAppPath)}`);
64
+ const exportEmbedOptions = inputs.embed_bundle_assets.value
65
+ ? {
66
+ sourcemapOutput: undefined,
67
+ }
68
+ : undefined;
69
+ stepsCtx.logger.info('Repacking the app...');
70
+ switch (platform) {
71
+ case eas_build_job_1.Platform.IOS:
72
+ await (0, repack_app_1.repackAppIosAsync)({
73
+ platform: 'ios',
74
+ projectRoot,
75
+ sourceAppPath,
76
+ outputPath,
77
+ workingDirectory,
78
+ exportEmbedOptions,
79
+ iosSigningOptions: await resolveIosSigningOptionsAsync({
80
+ job: stepsCtx.global.staticContext.job,
75
81
  logger: stepsCtx.logger,
76
- buildCredentials: (_b = stepsCtx.global.staticContext.job.secrets) === null || _b === void 0 ? void 0 : _b.buildCredentials,
77
82
  }),
78
- logger: stepsCtx.logger,
79
- verbose: env.__EAS_REPACK_VERBOSE !== undefined,
80
- env: {
81
- FASTLANE_DISABLE_COLORS: '1',
82
- FASTLANE_SKIP_UPDATE_CHECK: '1',
83
- SKIP_SLOW_FASTLANE_WARNING: 'true',
84
- FASTLANE_HIDE_TIMESTAMP: 'true',
85
- LC_ALL: 'en_US.UTF-8',
86
- ...env,
87
- },
88
- });
89
- }
90
- else if (stepsCtx.global.staticContext.job.platform === eas_build_job_1.Platform.ANDROID) {
91
- let androidCredentials;
92
- if ((_d = (_c = stepsCtx.global.staticContext.job.secrets) === null || _c === void 0 ? void 0 : _c.buildCredentials) === null || _d === void 0 ? void 0 : _d.keystore.dataBase64) {
93
- const keyStorePath = path_1.default.join(tmpDir, `keystore-${(0, uuid_1.v4)()}`);
94
- await fs_extra_1.default.writeFile(keyStorePath, Buffer.from(stepsCtx.global.staticContext.job.secrets.buildCredentials.keystore.dataBase64, 'base64'));
95
- androidCredentials = {
96
- keyStorePath,
97
- keyStorePassword: `pass:${stepsCtx.global.staticContext.job.secrets.buildCredentials.keystore.keystorePassword}`,
98
- keyAlias: stepsCtx.global.staticContext.job.secrets.buildCredentials.keystore.keyAlias,
99
- keyPassword: stepsCtx.global.staticContext.job.secrets.buildCredentials.keystore
100
- .keyPassword
101
- ? `pass:${stepsCtx.global.staticContext.job.secrets.buildCredentials.keystore.keyPassword}`
102
- : undefined,
103
- };
104
- }
105
- await (0, repack_app_1.repackAppAndroidAsync)({
106
- platform: 'android',
107
- projectRoot: stepsCtx.workingDirectory,
108
- sourceAppPath: goldenArchivePath,
109
- outputPath: repackedArchivePath,
110
- workingDirectory,
111
- androidSigningOptions: androidCredentials,
112
- logger: stepsCtx.logger,
113
- verbose: env.__EAS_REPACK_VERBOSE !== undefined,
114
- env,
115
- });
116
- }
117
- else {
118
- throw new Error('Unsupported platform');
119
- }
120
- if (!(await fs_extra_1.default.exists(repackedArchivePath))) {
121
- throw new Error(`Failed to repack the app. ${repackedArchivePath} does not exist`);
83
+ logger: stepsCtx.logger,
84
+ spawnAsync: repackSpawnAsync,
85
+ verbose,
86
+ env: {
87
+ ...fastlane_1.COMMON_FASTLANE_ENV,
88
+ ...env,
89
+ },
90
+ });
91
+ break;
92
+ case eas_build_job_1.Platform.ANDROID:
93
+ {
94
+ const androidSigningOptions = await resolveAndroidSigningOptionsAsync({
95
+ job: stepsCtx.global.staticContext.job,
96
+ tmpDir,
97
+ });
98
+ try {
99
+ await (0, repack_app_1.repackAppAndroidAsync)({
100
+ platform: 'android',
101
+ projectRoot,
102
+ sourceAppPath,
103
+ outputPath,
104
+ workingDirectory,
105
+ exportEmbedOptions,
106
+ androidSigningOptions,
107
+ logger: stepsCtx.logger,
108
+ spawnAsync: repackSpawnAsync,
109
+ verbose,
110
+ env,
111
+ });
112
+ }
113
+ finally {
114
+ const keyStorePath = androidSigningOptions === null || androidSigningOptions === void 0 ? void 0 : androidSigningOptions.keyStorePath;
115
+ if (keyStorePath) {
116
+ await node_fs_1.default.promises.rm(keyStorePath, { force: true });
117
+ }
118
+ }
119
+ }
120
+ break;
122
121
  }
123
- stepsCtx.logger.info(`Repacked and resigned the app to ${repackedArchivePath}`);
124
- outputs.repacked_archive_path.set(repackedArchivePath);
122
+ stepsCtx.logger.info(`Repacked the app to ${outputPath}`);
123
+ outputs.output_path.set(outputPath);
125
124
  },
126
125
  });
127
126
  }
128
127
  exports.createRepackBuildFunction = createRepackBuildFunction;
129
- async function resolveIosSigningOptions({ buildCredentials, logger, }) {
130
- (0, assert_1.default)(buildCredentials, 'buildCredentials is required for repacking non-simulator iOS apps');
128
+ /**
129
+ * Creates `@expo/steps` based spawnAsync for repack.
130
+ */
131
+ function createSpawnAsyncStepAdapter({ verbose, logger, }) {
132
+ return function repackSpawnAsync(command, args, options) {
133
+ return (0, steps_1.spawnAsync)(command, args, {
134
+ ...options,
135
+ ...(verbose ? { logger, stdio: 'pipe' } : { logger: undefined }),
136
+ });
137
+ };
138
+ }
139
+ /**
140
+ * Resolves Android signing options from the job secrets.
141
+ */
142
+ async function resolveAndroidSigningOptionsAsync({ job, tmpDir, }) {
143
+ var _a;
144
+ const androidJob = job;
145
+ const buildCredentials = (_a = androidJob.secrets) === null || _a === void 0 ? void 0 : _a.buildCredentials;
146
+ if ((buildCredentials === null || buildCredentials === void 0 ? void 0 : buildCredentials.keystore.dataBase64) == null) {
147
+ return undefined;
148
+ }
149
+ const keyStorePath = node_path_1.default.join(tmpDir, `keystore-${(0, node_crypto_1.randomUUID)()}`);
150
+ await node_fs_1.default.promises.writeFile(keyStorePath, Buffer.from(buildCredentials.keystore.dataBase64, 'base64'));
151
+ const keyStorePassword = `pass:${buildCredentials.keystore.keystorePassword}`;
152
+ const keyAlias = buildCredentials.keystore.keyAlias;
153
+ const keyPassword = buildCredentials.keystore.keyPassword
154
+ ? `pass:${buildCredentials.keystore.keyPassword}`
155
+ : undefined;
156
+ return {
157
+ keyStorePath,
158
+ keyStorePassword,
159
+ keyAlias,
160
+ keyPassword,
161
+ };
162
+ }
163
+ exports.resolveAndroidSigningOptionsAsync = resolveAndroidSigningOptionsAsync;
164
+ /**
165
+ * Resolves iOS signing options from the job secrets.
166
+ */
167
+ async function resolveIosSigningOptionsAsync({ job, logger, }) {
168
+ var _a;
169
+ const iosJob = job;
170
+ const buildCredentials = (_a = iosJob.secrets) === null || _a === void 0 ? void 0 : _a.buildCredentials;
171
+ if (iosJob.simulator || buildCredentials == null) {
172
+ return undefined;
173
+ }
131
174
  const credentialsManager = new manager_1.default(buildCredentials);
132
175
  const credentials = await credentialsManager.prepare(logger);
176
+ const provisioningProfile = {};
177
+ for (const profile of Object.values(credentials.targetProvisioningProfiles)) {
178
+ provisioningProfile[profile.bundleIdentifier] = profile.path;
179
+ }
133
180
  return {
134
- provisioningProfile: Object.values(credentials.targetProvisioningProfiles)[0].path,
181
+ provisioningProfile,
135
182
  keychainPath: credentials.keychainPath,
136
183
  signingIdentity: credentials.applicationTargetProvisioningProfile.data.certificateCommonName,
137
184
  };
138
185
  }
186
+ exports.resolveIosSigningOptionsAsync = resolveIosSigningOptionsAsync;
139
187
  //# sourceMappingURL=repack.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"repack.js","sourceRoot":"","sources":["../../../src/steps/functions/repack.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,+BAAiC;AACjC,mCAAgC;AAChC,4CAAoB;AACpB,oDAA4B;AAE5B,uCAA6D;AAC7D,wDAA0B;AAC1B,uDAA+C;AAC/C,4DAA+B;AAC/B,iDAA4E;AAC5E,+BAAoC;AAIpC,+EAAqE;AAErE,MAAM,QAAQ,GAAG,IAAA,gBAAS,EAAC,eAAM,CAAC,QAAQ,CAAC,CAAC;AAE5C,SAAgB,yBAAyB;IACvC,OAAO,IAAI,qBAAa,CAAC;QACvB,SAAS,EAAE,KAAK;QAChB,EAAE,EAAE,yDAAyD;QAC7D,IAAI,EAAE,uDAAuD;QAC7D,eAAe,EAAE;YACf,uBAAe,CAAC,cAAc,CAAC;gBAC7B,EAAE,EAAE,uBAAuB;gBAC3B,QAAQ,EAAE,IAAI;aACf,CAAC;SACH;QACD,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE;;YACvC,MAAM,MAAM,GAAG,cAAI,CAAC,IAAI,CAAC,YAAE,CAAC,MAAM,EAAE,EAAE,mCA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mBAAmB,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;QAClF,YAAY,EAAE,WAAW,CAAC,YAAY;QACtC,eAAe,EAAE,WAAW,CAAC,oCAAoC,CAAC,IAAI,CAAC,qBAAqB;KAC7F,CAAC;AACJ,CAAC","sourcesContent":["import path from 'path';\nimport { promisify } from 'util';\nimport { Stream } from 'stream';\nimport os from 'os';\nimport assert from 'assert';\n\nimport { BuildFunction, BuildStepOutput } from '@expo/steps';\nimport fs from 'fs-extra';\nimport { Platform } from '@expo/eas-build-job';\nimport fetch from 'node-fetch';\nimport { repackAppAndroidAsync, repackAppIosAsync } from '@expo/repack-app';\nimport { v4 as uuidv4 } from 'uuid';\nimport { BuildCredentials } from '@expo/eas-build-job/dist/ios';\nimport { bunyan } from '@expo/logger';\n\nimport IosCredentialsManager from '../utils/ios/credentials/manager';\n\nconst pipeline = promisify(Stream.pipeline);\n\nexport function createRepackBuildFunction(): BuildFunction {\n return new BuildFunction({\n namespace: 'eas',\n id: '__download_and_repack_golden_development_client_archive',\n name: 'Download and repack golden development client archive',\n outputProviders: [\n BuildStepOutput.createProvider({\n id: 'repacked_archive_path',\n required: true,\n }),\n ],\n fn: async (stepsCtx, { outputs, env }) => {\n const tmpDir = path.join(os.tmpdir(), `eas-build-golden-dev-client-app-${uuidv4()}`);\n await fs.mkdirs(tmpDir);\n const workingDirectory = path.join(tmpDir, 'working-directory');\n await fs.mkdirs(workingDirectory);\n stepsCtx.logger.info(`Created temporary directory: ${tmpDir}`);\n\n stepsCtx.logger.info('Downloading golden development client archive...');\n const fileName =\n stepsCtx.global.staticContext.job.platform === Platform.IOS\n ? stepsCtx.global.staticContext.job.simulator\n ? 'golden-dev-client-simulator-latest.ipa'\n : 'golden-dev-client-device-latest.ipa'\n : 'golden-dev-client-latest.apk';\n const goldenArchiveUrl =\n env.__EAS_GOLDEN_DEV_CLIENT_URL ??\n `https://storage.googleapis.com/turtle-v2/onboarding/${fileName}`;\n const goldenArchivePath = path.join(tmpDir, fileName);\n try {\n const response = await fetch(goldenArchiveUrl, {\n timeout: 1 * 60 * 1000, // 1 minute\n });\n if (!response.ok) {\n throw new Error(`[${response.status}] ${response.statusText}`);\n }\n await pipeline(response.body, fs.createWriteStream(goldenArchivePath));\n } catch (error: any) {\n throw new Error(`Failed to download golden development client archive: ${error.message}`);\n }\n stepsCtx.logger.info(`Downloaded golden development client archive to ${goldenArchivePath}`);\n\n stepsCtx.logger.info('Repacking and resigning the app...');\n const repackedArchivePath = path.join(\n tmpDir,\n stepsCtx.global.staticContext.job.platform === Platform.IOS\n ? stepsCtx.global.staticContext.job.simulator\n ? 'target.zip'\n : 'target.ipa'\n : 'target.apk'\n );\n if (stepsCtx.global.staticContext.job.platform === Platform.IOS) {\n await repackAppIosAsync({\n platform: 'ios',\n projectRoot: stepsCtx.workingDirectory,\n sourceAppPath: goldenArchivePath,\n outputPath: repackedArchivePath,\n workingDirectory,\n iosSigningOptions: stepsCtx.global.staticContext.job.simulator\n ? undefined\n : await resolveIosSigningOptions({\n logger: stepsCtx.logger,\n buildCredentials: stepsCtx.global.staticContext.job.secrets?.buildCredentials,\n }),\n logger: stepsCtx.logger,\n verbose: env.__EAS_REPACK_VERBOSE !== undefined,\n env: {\n FASTLANE_DISABLE_COLORS: '1',\n FASTLANE_SKIP_UPDATE_CHECK: '1',\n SKIP_SLOW_FASTLANE_WARNING: 'true',\n FASTLANE_HIDE_TIMESTAMP: 'true',\n LC_ALL: 'en_US.UTF-8',\n ...env,\n },\n });\n } else if (stepsCtx.global.staticContext.job.platform === Platform.ANDROID) {\n let androidCredentials:\n | {\n keyStorePath: string;\n keyStorePassword: string;\n keyAlias: string;\n keyPassword: string | undefined;\n }\n | undefined;\n if (stepsCtx.global.staticContext.job.secrets?.buildCredentials?.keystore.dataBase64) {\n const keyStorePath = path.join(tmpDir, `keystore-${uuidv4()}`);\n await fs.writeFile(\n keyStorePath,\n Buffer.from(\n stepsCtx.global.staticContext.job.secrets.buildCredentials.keystore.dataBase64,\n 'base64'\n )\n );\n androidCredentials = {\n keyStorePath,\n keyStorePassword: `pass:${stepsCtx.global.staticContext.job.secrets.buildCredentials.keystore.keystorePassword}`,\n keyAlias: stepsCtx.global.staticContext.job.secrets.buildCredentials.keystore.keyAlias,\n keyPassword: stepsCtx.global.staticContext.job.secrets.buildCredentials.keystore\n .keyPassword\n ? `pass:${stepsCtx.global.staticContext.job.secrets.buildCredentials.keystore.keyPassword}`\n : undefined,\n };\n }\n\n await repackAppAndroidAsync({\n platform: 'android',\n projectRoot: stepsCtx.workingDirectory,\n sourceAppPath: goldenArchivePath,\n outputPath: repackedArchivePath,\n workingDirectory,\n androidSigningOptions: androidCredentials,\n logger: stepsCtx.logger,\n verbose: env.__EAS_REPACK_VERBOSE !== undefined,\n env,\n });\n } else {\n throw new Error('Unsupported platform');\n }\n\n if (!(await fs.exists(repackedArchivePath))) {\n throw new Error(`Failed to repack the app. ${repackedArchivePath} does not exist`);\n }\n\n stepsCtx.logger.info(`Repacked and resigned the app to ${repackedArchivePath}`);\n outputs.repacked_archive_path.set(repackedArchivePath);\n },\n });\n}\n\nasync function resolveIosSigningOptions({\n buildCredentials,\n logger,\n}: {\n buildCredentials: BuildCredentials | undefined;\n logger: bunyan;\n}): Promise<{\n provisioningProfile: string;\n keychainPath: string;\n signingIdentity: string;\n}> {\n assert(buildCredentials, 'buildCredentials is required for repacking non-simulator iOS apps');\n\n const credentialsManager = new IosCredentialsManager(buildCredentials);\n const credentials = await credentialsManager.prepare(logger);\n\n return {\n provisioningProfile: Object.values(credentials.targetProvisioningProfiles)[0].path,\n keychainPath: credentials.keychainPath,\n signingIdentity: credentials.applicationTargetProvisioningProfile.data.certificateCommonName,\n };\n}\n"]}
1
+ {"version":3,"file":"repack.js","sourceRoot":"","sources":["../../../src/steps/functions/repack.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAyC;AACzC,sDAAyB;AACzB,sDAAyB;AACz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Content":["import { randomUUID } from 'node:crypto';\nimport fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\n\nimport { Platform, type Android, type Ios, type Job } from '@expo/eas-build-job';\nimport { type bunyan } from '@expo/logger';\nimport {\n BuildFunction,\n BuildStepInput,\n BuildStepInputValueTypeName,\n BuildStepOutput,\n spawnAsync,\n} from '@expo/steps';\nimport {\n repackAppAndroidAsync,\n repackAppIosAsync,\n type AndroidSigningOptions,\n type IosSigningOptions,\n type SpawnProcessAsync,\n type SpawnProcessOptions,\n type SpawnProcessPromise,\n type SpawnProcessResult,\n} from '@expo/repack-app';\n\nimport { COMMON_FASTLANE_ENV } from '../../common/fastlane';\nimport IosCredentialsManager from '../utils/ios/credentials/manager';\n\nexport function createRepackBuildFunction(): BuildFunction {\n return new BuildFunction({\n namespace: 'eas',\n id: 'repack',\n name: 'Repack app',\n inputProviders: [\n BuildStepInput.createProvider({\n id: 'source_app_path',\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n required: true,\n }),\n BuildStepInput.createProvider({\n id: 'platform',\n required: false,\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n }),\n BuildStepInput.createProvider({\n id: 'output_path',\n allowedValueTypeName: BuildStepInputValueTypeName.STRING,\n required: false,\n }),\n BuildStepInput.createProvider({\n id: 'embed_bundle_assets',\n allowedValueTypeName: BuildStepInputValueTypeName.BOOLEAN,\n required: false,\n }),\n ],\n outputProviders: [\n BuildStepOutput.createProvider({\n id: 'output_path',\n required: true,\n }),\n ],\n fn: async (stepsCtx, { inputs, outputs, env }) => {\n const projectRoot = stepsCtx.workingDirectory;\n const verbose = stepsCtx.global.env['EAS_VERBOSE'] === '1';\n\n const platform =\n (inputs.platform.value as Platform) ?? stepsCtx.global.staticContext.job.platform;\n if (![Platform.ANDROID, Platform.IOS].includes(platform)) {\n throw new Error(\n `Unsupported platform: ${platform}. Platform must be \"${Platform.ANDROID}\" or \"${Platform.IOS}\"`\n );\n }\n\n const repackSpawnAsync = createSpawnAsyncStepAdapter({ verbose, logger: stepsCtx.logger });\n\n const tmpDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), `repack-`));\n const workingDirectory = path.join(tmpDir, 'working-directory');\n await fs.promises.mkdir(workingDirectory);\n stepsCtx.logger.info(`Created temporary working directory: ${workingDirectory}`);\n\n const sourceAppPath = inputs.source_app_path.value as string;\n const outputPath =\n (inputs.output_path.value as string) ??\n path.join(tmpDir, `repacked-${randomUUID()}${path.extname(sourceAppPath)}`);\n const exportEmbedOptions = inputs.embed_bundle_assets.value\n ? {\n sourcemapOutput: undefined,\n }\n : undefined;\n\n stepsCtx.logger.info('Repacking the app...');\n switch (platform) {\n case Platform.IOS:\n await repackAppIosAsync({\n platform: 'ios',\n projectRoot,\n sourceAppPath,\n outputPath,\n workingDirectory,\n exportEmbedOptions,\n iosSigningOptions: await resolveIosSigningOptionsAsync({\n job: stepsCtx.global.staticContext.job,\n logger: stepsCtx.logger,\n }),\n logger: stepsCtx.logger,\n spawnAsync: repackSpawnAsync,\n verbose,\n env: {\n ...COMMON_FASTLANE_ENV,\n ...env,\n },\n });\n break;\n case Platform.ANDROID:\n {\n const androidSigningOptions = await resolveAndroidSigningOptionsAsync({\n job: stepsCtx.global.staticContext.job,\n tmpDir,\n });\n\n try {\n await repackAppAndroidAsync({\n platform: 'android',\n projectRoot,\n sourceAppPath,\n outputPath,\n workingDirectory,\n exportEmbedOptions,\n androidSigningOptions,\n logger: stepsCtx.logger,\n spawnAsync: repackSpawnAsync,\n verbose,\n env,\n });\n } finally {\n const keyStorePath = androidSigningOptions?.keyStorePath;\n if (keyStorePath) {\n await fs.promises.rm(keyStorePath, { force: true });\n }\n }\n }\n break;\n }\n\n stepsCtx.logger.info(`Repacked the app to ${outputPath}`);\n outputs.output_path.set(outputPath);\n },\n });\n}\n\n/**\n * Creates `@expo/steps` based spawnAsync for repack.\n */\nfunction createSpawnAsyncStepAdapter({\n verbose,\n logger,\n}: {\n verbose: boolean;\n logger: bunyan;\n}): SpawnProcessAsync {\n return function repackSpawnAsync(\n command: string,\n args: string[],\n options?: SpawnProcessOptions\n ): SpawnProcessPromise<SpawnProcessResult> {\n return spawnAsync(command, args, {\n ...options,\n ...(verbose ? { logger, stdio: 'pipe' } : { logger: undefined }),\n });\n };\n}\n\n/**\n * Resolves Android signing options from the job secrets.\n */\nexport async function resolveAndroidSigningOptionsAsync({\n job,\n tmpDir,\n}: {\n job: Job;\n tmpDir: string;\n}): Promise<AndroidSigningOptions | undefined> {\n const androidJob = job as Android.Job;\n const buildCredentials = androidJob.secrets?.buildCredentials;\n if (buildCredentials?.keystore.dataBase64 == null) {\n return undefined;\n }\n const keyStorePath = path.join(tmpDir, `keystore-${randomUUID()}`);\n await fs.promises.writeFile(\n keyStorePath,\n Buffer.from(buildCredentials.keystore.dataBase64, 'base64')\n );\n\n const keyStorePassword = `pass:${buildCredentials.keystore.keystorePassword}`;\n const keyAlias = buildCredentials.keystore.keyAlias;\n const keyPassword = buildCredentials.keystore.keyPassword\n ? `pass:${buildCredentials.keystore.keyPassword}`\n : undefined;\n return {\n keyStorePath,\n keyStorePassword,\n keyAlias,\n keyPassword,\n };\n}\n\n/**\n * Resolves iOS signing options from the job secrets.\n */\nexport async function resolveIosSigningOptionsAsync({\n job,\n logger,\n}: {\n job: Job;\n logger: bunyan;\n}): Promise<IosSigningOptions | undefined> {\n const iosJob = job as Ios.Job;\n const buildCredentials = iosJob.secrets?.buildCredentials;\n if (iosJob.simulator || buildCredentials == null) {\n return undefined;\n }\n const credentialsManager = new IosCredentialsManager(buildCredentials);\n const credentials = await credentialsManager.prepare(logger);\n\n const provisioningProfile: Record<string, string> = {};\n for (const profile of Object.values(credentials.targetProvisioningProfiles)) {\n provisioningProfile[profile.bundleIdentifier] = profile.path;\n }\n return {\n provisioningProfile,\n keychainPath: credentials.keychainPath,\n signingIdentity: credentials.applicationTargetProvisioningProfile.data.certificateCommonName,\n };\n}\n"]}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.runFastlane = exports.runFastlaneGym = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const turtle_spawn_1 = __importDefault(require("@expo/turtle-spawn"));
9
+ const fastlane_1 = require("../../../common/fastlane");
9
10
  const xcpretty_1 = require("./xcpretty");
10
11
  async function runFastlaneGym({ workingDir, logger, buildLogsDirectory, env, extraEnv, }) {
11
12
  const buildLogger = new xcpretty_1.XcodeBuildLogger(logger, workingDir);
@@ -24,17 +25,12 @@ async function runFastlaneGym({ workingDir, logger, buildLogsDirectory, env, ext
24
25
  }
25
26
  exports.runFastlaneGym = runFastlaneGym;
26
27
  async function runFastlane(fastlaneArgs, { logger, env, cwd, extraEnv, } = {}) {
27
- const fastlaneEnvVars = {
28
- FASTLANE_DISABLE_COLORS: '1',
29
- FASTLANE_SKIP_UPDATE_CHECK: '1',
30
- SKIP_SLOW_FASTLANE_WARNING: 'true',
31
- FASTLANE_HIDE_TIMESTAMP: 'true',
32
- LC_ALL: 'en_US.UTF-8',
33
- ...(env !== null && env !== void 0 ? env : process.env),
34
- ...extraEnv,
35
- };
36
28
  return await (0, turtle_spawn_1.default)('fastlane', fastlaneArgs, {
37
- env: fastlaneEnvVars,
29
+ env: {
30
+ ...fastlane_1.COMMON_FASTLANE_ENV,
31
+ ...(env !== null && env !== void 0 ? env : process.env),
32
+ ...extraEnv,
33
+ },
38
34
  logger,
39
35
  cwd,
40
36
  });
@@ -1 +1 @@
1
- {"version":3,"file":"fastlane.js","sourceRoot":"","sources":["../../../../src/steps/utils/ios/fastlane.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAGxB,sEAAwD;AAGxD,yCAA8C;AAEvC,KAAK,UAAU,cAAc,CAAC,EACnC,UAAU,EACV,MAAM,EACN,kBAAkB,EAClB,GAAG,EACH,QAAQ,GAOT;IACC,MAAM,WAAW,GAAG,IAAI,2BAAgB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC7D,KAAK,WAAW,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;IACnD,IAAI,CAAC;QACH,MAAM,WAAW,CAAC,CAAC,KAAK,CAAC,EAAE;YACzB,GAAG,EAAE,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC;YACjC,MAAM;YACN,GAAG;YACH,QAAQ;SACT,CAAC,CAAC;IACL,CAAC;YAAS,CAAC;QACT,MAAM,WAAW,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;AACH,CAAC;AAzBD,wCAyBC;AAEM,KAAK,UAAU,WAAW,CAC/B,YAAsB,EACtB,EACE,MAAM,EACN,GAAG,EACH,GAAG,EACH,QAAQ,MAMN,EAAE;IAEN,MAAM,eAAe,GAAG;QACtB,uBAAuB,EAAE,GAAG;QAC5B,0BAA0B,EAAE,GAAG;QAC/B,0BAA0B,EAAE,MAAM;QAClC,uBAAuB,EAAE,MAAM;QAC/B,MAAM,EAAE,aAAa;QACrB,GAAG,CAAC,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,OAAO,CAAC,GAAG,CAAC;QACvB,GAAG,QAAQ;KACZ,CAAC;IACF,OAAO,MAAM,IAAA,sBAAK,EAAC,UAAU,EAAE,YAAY,EAAE;QAC3C,GAAG,EAAE,eAAe;QACpB,MAAM;QACN,GAAG;KACJ,CAAC,CAAC;AACL,CAAC;AA5BD,kCA4BC","sourcesContent":["import path from 'path';\n\nimport { bunyan } from '@expo/logger';\nimport spawn, { SpawnResult } from '@expo/turtle-spawn';\nimport { BuildStepEnv } from '@expo/steps';\n\nimport { XcodeBuildLogger } from './xcpretty';\n\nexport async function runFastlaneGym({\n workingDir,\n logger,\n buildLogsDirectory,\n env,\n extraEnv,\n}: {\n workingDir: string;\n logger: bunyan;\n buildLogsDirectory: string;\n env: BuildStepEnv;\n extraEnv?: BuildStepEnv;\n}): Promise<void> {\n const buildLogger = new XcodeBuildLogger(logger, workingDir);\n void buildLogger.watchLogFiles(buildLogsDirectory);\n try {\n await runFastlane(['gym'], {\n cwd: path.join(workingDir, 'ios'),\n logger,\n env,\n extraEnv,\n });\n } finally {\n await buildLogger.flush();\n }\n}\n\nexport async function runFastlane(\n fastlaneArgs: string[],\n {\n logger,\n env,\n cwd,\n extraEnv,\n }: {\n logger?: bunyan;\n env?: BuildStepEnv;\n cwd?: string;\n extraEnv?: BuildStepEnv;\n } = {}\n): Promise<SpawnResult> {\n const fastlaneEnvVars = {\n FASTLANE_DISABLE_COLORS: '1',\n FASTLANE_SKIP_UPDATE_CHECK: '1',\n SKIP_SLOW_FASTLANE_WARNING: 'true',\n FASTLANE_HIDE_TIMESTAMP: 'true',\n LC_ALL: 'en_US.UTF-8',\n ...(env ?? process.env),\n ...extraEnv,\n };\n return await spawn('fastlane', fastlaneArgs, {\n env: fastlaneEnvVars,\n logger,\n cwd,\n });\n}\n"]}
1
+ {"version":3,"file":"fastlane.js","sourceRoot":"","sources":["../../../../src/steps/utils/ios/fastlane.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAGxB,sEAAwD;AAGxD,uDAA+D;AAE/D,yCAA8C;AAEvC,KAAK,UAAU,cAAc,CAAC,EACnC,UAAU,EACV,MAAM,EACN,kBAAkB,EAClB,GAAG,EACH,QAAQ,GAOT;IACC,MAAM,WAAW,GAAG,IAAI,2BAAgB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC7D,KAAK,WAAW,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;IACnD,IAAI,CAAC;QACH,MAAM,WAAW,CAAC,CAAC,KAAK,CAAC,EAAE;YACzB,GAAG,EAAE,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC;YACjC,MAAM;YACN,GAAG;YACH,QAAQ;SACT,CAAC,CAAC;IACL,CAAC;YAAS,CAAC;QACT,MAAM,WAAW,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;AACH,CAAC;AAzBD,wCAyBC;AAEM,KAAK,UAAU,WAAW,CAC/B,YAAsB,EACtB,EACE,MAAM,EACN,GAAG,EACH,GAAG,EACH,QAAQ,MAMN,EAAE;IAEN,OAAO,MAAM,IAAA,sBAAK,EAAC,UAAU,EAAE,YAAY,EAAE;QAC3C,GAAG,EAAE;YACH,GAAG,8BAAmB;YACtB,GAAG,CAAC,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,OAAO,CAAC,GAAG,CAAC;YACvB,GAAG,QAAQ;SACZ;QACD,MAAM;QACN,GAAG;KACJ,CAAC,CAAC;AACL,CAAC;AAvBD,kCAuBC","sourcesContent":["import path from 'path';\n\nimport { bunyan } from '@expo/logger';\nimport spawn, { SpawnResult } from '@expo/turtle-spawn';\nimport { BuildStepEnv } from '@expo/steps';\n\nimport { COMMON_FASTLANE_ENV } from '../../../common/fastlane';\n\nimport { XcodeBuildLogger } from './xcpretty';\n\nexport async function runFastlaneGym({\n workingDir,\n logger,\n buildLogsDirectory,\n env,\n extraEnv,\n}: {\n workingDir: string;\n logger: bunyan;\n buildLogsDirectory: string;\n env: BuildStepEnv;\n extraEnv?: BuildStepEnv;\n}): Promise<void> {\n const buildLogger = new XcodeBuildLogger(logger, workingDir);\n void buildLogger.watchLogFiles(buildLogsDirectory);\n try {\n await runFastlane(['gym'], {\n cwd: path.join(workingDir, 'ios'),\n logger,\n env,\n extraEnv,\n });\n } finally {\n await buildLogger.flush();\n }\n}\n\nexport async function runFastlane(\n fastlaneArgs: string[],\n {\n logger,\n env,\n cwd,\n extraEnv,\n }: {\n logger?: bunyan;\n env?: BuildStepEnv;\n cwd?: string;\n extraEnv?: BuildStepEnv;\n } = {}\n): Promise<SpawnResult> {\n return await spawn('fastlane', fastlaneArgs, {\n env: {\n ...COMMON_FASTLANE_ENV,\n ...(env ?? process.env),\n ...extraEnv,\n },\n logger,\n cwd,\n });\n}\n"]}
@@ -18,6 +18,7 @@ async function uploadJobOutputsToWwwAsync(ctx, { logger, expoApiV2BaseUrl }) {
18
18
  const robotAccessToken = (0, nullthrows_1.default)((_a = ctx.staticContext.job.secrets) === null || _a === void 0 ? void 0 : _a.robotAccessToken);
19
19
  const interpolationContext = {
20
20
  ...ctx.staticContext,
21
+ env: ctx.env,
21
22
  always: () => true,
22
23
  never: () => false,
23
24
  success: () => !ctx.hasAnyPreviousStepFailed,
@@ -1 +1 @@
1
- {"version":3,"file":"outputs.js","sourceRoot":"","sources":["../../src/utils/outputs.ts"],"names":[],"mappings":";;;;;;AACA,uCAA+D;AAE/D,4DAAoC;AAEpC,+CAA4C;AAErC,KAAK,UAAU,0BAA0B,CAC9C,GAA2B,EAC3B,EAAE,MAAM,EAAE,gBAAgB,EAAgD;;IAE1E,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACnC,MAAM,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;QACvD,OAAO;IACT,CAAC;IAED,IAAI,CAAC;QACH,MAAM,aAAa,GAAG,IAAA,oBAAU,EAAC,GAAG,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAC5D,MAAM,gBAAgB,GAAG,IAAA,oBAAU,EAAC,MAAA,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,0CAAE,gBAAgB,CAAC,CAAC;QAErF,MAAM,oBAAoB,GAA4B;YACpD,GAAG,GAAG,CAAC,aAAa;YACpB,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI;YAClB,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK;YAClB,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,wBAAwB;YAC5C,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,wBAAwB;YAC3C,QAAQ,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;YAC5C,MAAM,EAAE,CAAC,KAAc,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;YACjD,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,CAAC,KAAK,C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AC,kBAAkB,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;;YACtF,OAAO,GAAG,MAAA,IAAA,gBAAQ,EAAC,UAAU,EAAE,oBAAoB,CAAC,mCAAI,EAAE,EAAE,CAAC;QAC/D,CAAC,CAAC,CAAC;QAEH,UAAU,CAAC,SAAS,CAAC,GAAG,WAAW,CAAC;IACtC,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAjBD,8CAiBC","sourcesContent":["import { JobInterpolationContext } from '@expo/eas-build-job';\nimport { BuildStepGlobalContext, jsepEval } from '@expo/steps';\nimport { bunyan } from '@expo/logger';\nimport nullthrows from 'nullthrows';\n\nimport { turtleFetch } from './turtleFetch';\n\nexport async function uploadJobOutputsToWwwAsync(\n ctx: BuildStepGlobalContext,\n { logger, expoApiV2BaseUrl }: { logger: bunyan; expoApiV2BaseUrl: string }\n): Promise<void> {\n if (!ctx.staticContext.job.outputs) {\n logger.info('Job defines no outputs, skipping upload');\n return;\n }\n\n try {\n const workflowJobId = nullthrows(ctx.env.__WORKFLOW_JOB_ID);\n const robotAccessToken = nullthrows(ctx.staticContext.job.secrets?.robotAccessToken);\n\n const interpolationContext: JobInterpolationContext = {\n ...ctx.staticContext,\n always: () => true,\n never: () => false,\n success: () => !ctx.hasAnyPreviousStepFailed,\n failure: () => ctx.hasAnyPreviousStepFailed,\n fromJSON: (json: string) => JSON.parse(json),\n toJSON: (value: unknown) => JSON.stringify(value),\n contains: (value, substring) => value.includes(substring),\n startsWith: (value, prefix) => value.startsWith(prefix),\n endsWith: (value, suffix) => value.endsWith(suffix),\n };\n logger.debug({ dynamicValues: interpolationContext }, 'Using dynamic values');\n\n const outputs = collectJobOutputs({\n jobOutputDefinitions: ctx.staticContext.job.outputs,\n interpolationContext,\n });\n logger.info('Uploading outputs');\n\n await turtleFetch(new URL(`workflows/${workflowJobId}`, expoApiV2BaseUrl).toString(), 'PATCH', {\n json: { outputs },\n headers: {\n Authorization: `Bearer ${robotAccessToken}`,\n },\n timeout: 20000,\n logger,\n });\n } catch (err) {\n logger.error({ err }, 'Failed to upload outputs');\n throw err;\n }\n}\n\n/** Function we use to get outputs of the whole job from steps. */\nexport function collectJobOutputs({\n jobOutputDefinitions,\n interpolationContext,\n}: {\n jobOutputDefinitions: Record<string, string>;\n interpolationContext: JobInterpolationContext;\n}): Record<string, string | undefined> {\n const jobOutputs: Record<string, string | undefined> = {};\n for (const [outputKey, outputDefinition] of Object.entries(jobOutputDefinitions)) {\n const outputValue = outputDefinition.replace(/\\$\\{\\{(.+?)\\}\\}/g, (_match, expression) => {\n return `${jsepEval(expression, interpolationContext) ?? ''}`;\n });\n\n jobOutputs[outputKey] = outputValue;\n }\n\n return jobOutputs;\n}\n"]}
1
+ {"version":3,"file":"outputs.js","sourceRoot":"","sources":["../../src/utils/outputs.ts"],"names":[],"mappings":";;;;;;AACA,uCAA+D;AAE/D,4DAAoC;AAEpC,+CAA4C;AAErC,KAAK,UAAU,0BAA0B,CAC9C,GAA2B,EAC3B,EAAE,MAAM,EAAE,gBAAgB,EAAgD;;IAE1E,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACnC,MAAM,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;QACvD,OAAO;IACT,CAAC;IAED,IAAI,CAAC;QACH,MAAM,aAAa,GAAG,IAAA,oBAAU,EAAC,GAAG,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAC5D,MAAM,gBAAgB,GAAG,IAAA,oBAAU,EAAC,MAAA,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,0CAAE,gBAAgB,CAAC,CAAC;QAErF,MAAM,oBAAoB,GAA4B;YACpD,GAAG,GAAG,CAAC,aAAa;YACpB,GAAG,EAAE,GAAG,CAAC,GAAG;YACZ,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI;YAClB,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK;YAClB,OAAO,EAAE,GA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AC,CAAC;QAClD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC;AA9CD,gEA8CC;AAED,kEAAkE;AAClE,SAAgB,iBAAiB,CAAC,EAChC,oBAAoB,EACpB,oBAAoB,GAIrB;IACC,MAAM,UAAU,GAAuC,EAAE,CAAC;IAC1D,KAAK,MAAM,CAAC,SAAS,EAAE,gBAAgB,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE,CAAC;QACjF,MAAM,WAAW,GAAG,gBAAgB,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE;;YACtF,OAAO,GAAG,MAAA,IAAA,gBAAQ,EAAC,UAAU,EAAE,oBAAoB,CAAC,mCAAI,EAAE,EAAE,CAAC;QAC/D,CAAC,CAAC,CAAC;QAEH,UAAU,CAAC,SAAS,CAAC,GAAG,WAAW,CAAC;IACtC,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAjBD,8CAiBC","sourcesContent":["import { JobInterpolationContext } from '@expo/eas-build-job';\nimport { BuildStepGlobalContext, jsepEval } from '@expo/steps';\nimport { bunyan } from '@expo/logger';\nimport nullthrows from 'nullthrows';\n\nimport { turtleFetch } from './turtleFetch';\n\nexport async function uploadJobOutputsToWwwAsync(\n ctx: BuildStepGlobalContext,\n { logger, expoApiV2BaseUrl }: { logger: bunyan; expoApiV2BaseUrl: string }\n): Promise<void> {\n if (!ctx.staticContext.job.outputs) {\n logger.info('Job defines no outputs, skipping upload');\n return;\n }\n\n try {\n const workflowJobId = nullthrows(ctx.env.__WORKFLOW_JOB_ID);\n const robotAccessToken = nullthrows(ctx.staticContext.job.secrets?.robotAccessToken);\n\n const interpolationContext: JobInterpolationContext = {\n ...ctx.staticContext,\n env: ctx.env,\n always: () => true,\n never: () => false,\n success: () => !ctx.hasAnyPreviousStepFailed,\n failure: () => ctx.hasAnyPreviousStepFailed,\n fromJSON: (json: string) => JSON.parse(json),\n toJSON: (value: unknown) => JSON.stringify(value),\n contains: (value, substring) => value.includes(substring),\n startsWith: (value, prefix) => value.startsWith(prefix),\n endsWith: (value, suffix) => value.endsWith(suffix),\n };\n logger.debug({ dynamicValues: interpolationContext }, 'Using dynamic values');\n\n const outputs = collectJobOutputs({\n jobOutputDefinitions: ctx.staticContext.job.outputs,\n interpolationContext,\n });\n logger.info('Uploading outputs');\n\n await turtleFetch(new URL(`workflows/${workflowJobId}`, expoApiV2BaseUrl).toString(), 'PATCH', {\n json: { outputs },\n headers: {\n Authorization: `Bearer ${robotAccessToken}`,\n },\n timeout: 20000,\n logger,\n });\n } catch (err) {\n logger.error({ err }, 'Failed to upload outputs');\n throw err;\n }\n}\n\n/** Function we use to get outputs of the whole job from steps. */\nexport function collectJobOutputs({\n jobOutputDefinitions,\n interpolationContext,\n}: {\n jobOutputDefinitions: Record<string, string>;\n interpolationContext: JobInterpolationContext;\n}): Record<string, string | undefined> {\n const jobOutputs: Record<string, string | undefined> = {};\n for (const [outputKey, outputDefinition] of Object.entries(jobOutputDefinitions)) {\n const outputValue = outputDefinition.replace(/\\$\\{\\{(.+?)\\}\\}/g, (_match, expression) => {\n return `${jsepEval(expression, interpolationContext) ?? ''}`;\n });\n\n jobOutputs[outputKey] = outputValue;\n }\n\n return jobOutputs;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo/build-tools",
3
- "version": "1.0.183",
3
+ "version": "1.0.185",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -25,14 +25,14 @@
25
25
  "@expo/config": "10.0.6",
26
26
  "@expo/config-plugins": "9.0.12",
27
27
  "@expo/downloader": "1.0.118",
28
- "@expo/eas-build-job": "1.0.182",
28
+ "@expo/eas-build-job": "1.0.185",
29
29
  "@expo/env": "^0.4.0",
30
30
  "@expo/logger": "1.0.117",
31
31
  "@expo/package-manager": "1.7.0",
32
32
  "@expo/plist": "^0.2.0",
33
- "@expo/repack-app": "0.0.6",
33
+ "@expo/repack-app": "~0.2.3",
34
34
  "@expo/results": "^1.0.0",
35
- "@expo/steps": "1.0.182",
35
+ "@expo/steps": "1.0.185",
36
36
  "@expo/template-file": "1.0.117",
37
37
  "@expo/turtle-spawn": "1.0.117",
38
38
  "@expo/xcpretty": "^4.3.1",
@@ -76,5 +76,5 @@
76
76
  "node": "20.14.0",
77
77
  "yarn": "1.22.21"
78
78
  },
79
- "gitHead": "277dcd76d4d3c2a7f72cdf041e1e3e4438c91dad"
79
+ "gitHead": "ca087e7a6cfced26bc64fc601a24b3d7f8100e16"
80
80
  }