@expo/build-tools 1.0.172 → 1.0.174

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/generic.js CHANGED
@@ -34,8 +34,7 @@ async function runGenericJobAsync(ctx, { expoApiV2BaseUrl }) {
34
34
  });
35
35
  const runResult = await (0, results_1.asyncResult)(workflow.executeAsync());
36
36
  await ctx.runBuildPhase(eas_build_job_1.BuildPhase.COMPLETE_JOB, async () => {
37
- await (0, outputs_1.uploadJobOutputsToWwwAsync)(ctx, {
38
- steps: workflow.buildSteps,
37
+ await (0, outputs_1.uploadJobOutputsToWwwAsync)(globalContext, {
39
38
  logger: ctx.logger,
40
39
  expoApiV2BaseUrl,
41
40
  });
@@ -1 +1 @@
1
- {"version":3,"file":"generic.js","sourceRoot":"","sources":["../src/generic.ts"],"names":[],"mappings":";;;AAAA,uDAA0D;AAC1D,uCAA+F;AAC/F,2CAAoD;AAGpD,4DAAqE;AACrE,uDAAuD;AACvD,6DAA0D;AAC1D,iEAAiE;AACjE,6CAA6D;AAEtD,KAAK,UAAU,kBAAkB,CACtC,GAA8B,EAC9B,EAAE,gBAAgB,EAAgC;IAElD,MAAM,cAAc,GAAG,IAAI,uCAAkB,CAAC,GAAG,CAAC,CAAC;IAEnD,MAAM,IAAA,2CAA0B,EAAC,GAAG,EAAE,cAAc,CAAC,sBAAsB,CAAC,CAAC;IAE7E,MAAM,aAAa,GAAG,IAAI,8BAAsB,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IAExE,MAAM,MAAM,GAAG,IAAI,yBAAiB,CAAC,aAAa,EAAE;QAClD,iBAAiB,EAAE,IAAA,8BAAe,EAAC,cAAc,CAAC;QAClD,sBAAsB,EAAE,IAAA,wCAAoB,EAAC,cAAc,CAAC;QAC5D,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,KAAK;KACrB,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,aAAa,CAAC,0BAAU,CAAC,4BAA4B,EAAE,KAAK,IAAI,EAAE;QAC3F,IAAI,CAAC;YACH,OAAO,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;QACnC,CAAC;QAAC,OAAO,UAAe,EAAE,CAAC;YACzB,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;YAC7D,IAAI,UAAU,YAAY,cAAM,CAAC,kBAAkB,EAAE,CAAC;gBACpD,KAAK,MAAM,GAAG,IAAI,UAAU,CAAC,MAAM,EAAE,CAAC;oBACpC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;gBAC5B,CAAC;YACH,CAAC;YACD,MAAM,UAAU,CAAC;QACnB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,SAAS,GAAG,MAAM,IAAA,qBAAW,EAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC;IAE7D,MAAM,GAAG,CAAC,aAAa,CAAC,0BAAU,CAAC,YAAY,EAAE,KAAK,IAAI,EAAE;QAC1D,MAAM,IAAA,oCAA0B,EAAC,GAAG,EAAE;YACpC,KAAK,EAAE,QAAQ,CAAC,UAAU;YAC1B,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,gBAAgB;SACjB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC;AAChD,CAAC;AAzCD,gDAyCC","sourcesContent":["import { BuildPhase, Generic } from '@expo/eas-build-job';\nimport { BuildStepGlobalContext, BuildWorkflow, errors, StepsConfigParser } from '@expo/steps';\nimport { Result, asyncResult } from '@expo/results';\n\nimport { BuildContext } from './context';\nimport { prepareProjectSourcesAsync } from './common/projectSources';\nimport { getEasFunctions } from './steps/easFunctions';\nimport { CustomBuildContext } from './customBuildContext';\nimport { getEasFunctionGroups } from './steps/easFunctionGroups';\nimport { uploadJobOutputsToWwwAsync } from './utils/outputs';\n\nexport async function runGenericJobAsync(\n ctx: BuildContext<Generic.Job>,\n { expoApiV2BaseUrl }: { expoApiV2BaseUrl: string }\n): Promise<{ runResult: Result<void>; buildWorkflow: BuildWorkflow }> {\n const customBuildCtx = new CustomBuildContext(ctx);\n\n await prepareProjectSourcesAsync(ctx, customBuildCtx.projectSourceDirectory);\n\n const globalContext = new BuildStepGlobalContext(customBuildCtx, false);\n\n const parser = new StepsConfigParser(globalContext, {\n externalFunctions: getEasFunctions(customBuildCtx),\n externalFunctionGroups: getEasFunctionGroups(customBuildCtx),\n steps: ctx.job.steps,\n });\n\n const workflow = await ctx.runBuildPhase(BuildPhase.PARSE_CUSTOM_WORKFLOW_CONFIG, async () => {\n try {\n return await parser.parseAsync();\n } catch (parseError: any) {\n ctx.logger.error('Failed to parse the job definition file.');\n if (parseError instanceof errors.BuildWorkflowError) {\n for (const err of parseError.errors) {\n ctx.logger.error({ err });\n }\n }\n throw parseError;\n }\n });\n\n const runResult = await asyncResult(workflow.executeAsync());\n\n await ctx.runBuildPhase(BuildPhase.COMPLETE_JOB, async () => {\n await uploadJobOutputsToWwwAsync(ctx, {\n steps: workflow.buildSteps,\n logger: ctx.logger,\n expoApiV2BaseUrl,\n });\n });\n\n return { runResult, buildWorkflow: workflow };\n}\n"]}
1
+ {"version":3,"file":"generic.js","sourceRoot":"","sources":["../src/generic.ts"],"names":[],"mappings":";;;AAAA,uDAA0D;AAC1D,uCAA+F;AAC/F,2CAAoD;AAGpD,4DAAqE;AACrE,uDAAuD;AACvD,6DAA0D;AAC1D,iEAAiE;AACjE,6CAA6D;AAEtD,KAAK,UAAU,kBAAkB,CACtC,GAA8B,EAC9B,EAAE,gBAAgB,EAAgC;IAElD,MAAM,cAAc,GAAG,IAAI,uCAAkB,CAAC,GAAG,CAAC,CAAC;IAEnD,MAAM,IAAA,2CAA0B,EAAC,GAAG,EAAE,cAAc,CAAC,sBAAsB,CAAC,CAAC;IAE7E,MAAM,aAAa,GAAG,IAAI,8BAAsB,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from '@expo/eas-build-job';\nimport { BuildStepGlobalContext, BuildWorkflow, errors, StepsConfigParser } from '@expo/steps';\nimport { Result, asyncResult } from '@expo/results';\n\nimport { BuildContext } from './context';\nimport { prepareProjectSourcesAsync } from './common/projectSources';\nimport { getEasFunctions } from './steps/easFunctions';\nimport { CustomBuildContext } from './customBuildContext';\nimport { getEasFunctionGroups } from './steps/easFunctionGroups';\nimport { uploadJobOutputsToWwwAsync } from './utils/outputs';\n\nexport async function runGenericJobAsync(\n ctx: BuildContext<Generic.Job>,\n { expoApiV2BaseUrl }: { expoApiV2BaseUrl: string }\n): Promise<{ runResult: Result<void>; buildWorkflow: BuildWorkflow }> {\n const customBuildCtx = new CustomBuildContext(ctx);\n\n await prepareProjectSourcesAsync(ctx, customBuildCtx.projectSourceDirectory);\n\n const globalContext = new BuildStepGlobalContext(customBuildCtx, false);\n\n const parser = new StepsConfigParser(globalContext, {\n externalFunctions: getEasFunctions(customBuildCtx),\n externalFunctionGroups: getEasFunctionGroups(customBuildCtx),\n steps: ctx.job.steps,\n });\n\n const workflow = await ctx.runBuildPhase(BuildPhase.PARSE_CUSTOM_WORKFLOW_CONFIG, async () => {\n try {\n return await parser.parseAsync();\n } catch (parseError: any) {\n ctx.logger.error('Failed to parse the job definition file.');\n if (parseError instanceof errors.BuildWorkflowError) {\n for (const err of parseError.errors) {\n ctx.logger.error({ err });\n }\n }\n throw parseError;\n }\n });\n\n const runResult = await asyncResult(workflow.executeAsync());\n\n await ctx.runBuildPhase(BuildPhase.COMPLETE_JOB, async () => {\n await uploadJobOutputsToWwwAsync(globalContext, {\n logger: ctx.logger,\n expoApiV2BaseUrl,\n });\n });\n\n return { runResult, buildWorkflow: workflow };\n}\n"]}
@@ -1,23 +1,13 @@
1
1
  /// <reference types="bunyan" />
2
- import { Generic } from '@expo/eas-build-job';
3
- import { BuildStep } from '@expo/steps';
2
+ import { JobInterpolationContext } from '@expo/eas-build-job';
3
+ import { BuildStepGlobalContext } from '@expo/steps';
4
4
  import { bunyan } from '@expo/logger';
5
- import { BuildContext } from '../context';
6
- export declare function uploadJobOutputsToWwwAsync(ctx: BuildContext<Generic.Job>, { steps, logger, expoApiV2BaseUrl, }: {
7
- steps: BuildStep[];
5
+ export declare function uploadJobOutputsToWwwAsync(ctx: BuildStepGlobalContext, { logger, expoApiV2BaseUrl }: {
8
6
  logger: bunyan;
9
7
  expoApiV2BaseUrl: string;
10
8
  }): Promise<void>;
11
9
  /** Function we use to get outputs of the whole job from steps. */
12
- export declare function getJobOutputsFromSteps({ jobOutputDefinitions, interpolationContext, }: {
10
+ export declare function collectJobOutputs({ jobOutputDefinitions, interpolationContext, }: {
13
11
  jobOutputDefinitions: Record<string, string>;
14
- interpolationContext: {
15
- steps: Record<string, {
16
- outputs: Record<string, string | undefined>;
17
- }>;
18
- };
12
+ interpolationContext: JobInterpolationContext;
19
13
  }): Record<string, string | undefined>;
20
- /** This is what we'll use to generate an object representing a step. */
21
- export declare function getStepOutputsAsObject(step: BuildStep): {
22
- outputs: Record<string, string | undefined>;
23
- };
@@ -3,25 +3,31 @@ 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.getStepOutputsAsObject = exports.getJobOutputsFromSteps = exports.uploadJobOutputsToWwwAsync = void 0;
6
+ exports.collectJobOutputs = exports.uploadJobOutputsToWwwAsync = void 0;
7
7
  const steps_1 = require("@expo/steps");
8
8
  const nullthrows_1 = __importDefault(require("nullthrows"));
9
9
  const turtleFetch_1 = require("./turtleFetch");
10
- async function uploadJobOutputsToWwwAsync(ctx, { steps, logger, expoApiV2BaseUrl, }) {
11
- var _a, _b, _c;
12
- if (!ctx.job.outputs) {
10
+ async function uploadJobOutputsToWwwAsync(ctx, { logger, expoApiV2BaseUrl }) {
11
+ var _a;
12
+ if (!ctx.staticContext.job.outputs) {
13
13
  logger.info('Job defines no outputs, skipping upload');
14
14
  return;
15
15
  }
16
16
  try {
17
- const workflowJobId = (0, nullthrows_1.default)((_b = (_a = ctx.job.builderEnvironment) === null || _a === void 0 ? void 0 : _a.env) === null || _b === void 0 ? void 0 : _b.__WORKFLOW_JOB_ID);
18
- const robotAccessToken = (0, nullthrows_1.default)((_c = ctx.job.secrets) === null || _c === void 0 ? void 0 : _c.robotAccessToken);
17
+ const workflowJobId = (0, nullthrows_1.default)(ctx.env.__WORKFLOW_JOB_ID);
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
- steps: Object.fromEntries(steps.map((step) => [step.id, getStepOutputsAsObject(step)])),
20
+ ...ctx.staticContext,
21
+ always: () => true,
22
+ never: () => false,
23
+ success: () => !ctx.hasAnyPreviousStepFailed,
24
+ failure: () => ctx.hasAnyPreviousStepFailed,
25
+ fromJSON: (json) => JSON.parse(json),
26
+ toJSON: (value) => JSON.stringify(value),
21
27
  };
22
28
  logger.debug({ dynamicValues: interpolationContext }, 'Using dynamic values');
23
- const outputs = getJobOutputsFromSteps({
24
- jobOutputDefinitions: ctx.job.outputs,
29
+ const outputs = collectJobOutputs({
30
+ jobOutputDefinitions: ctx.staticContext.job.outputs,
25
31
  interpolationContext,
26
32
  });
27
33
  logger.info('Uploading outputs');
@@ -41,7 +47,7 @@ async function uploadJobOutputsToWwwAsync(ctx, { steps, logger, expoApiV2BaseUrl
41
47
  }
42
48
  exports.uploadJobOutputsToWwwAsync = uploadJobOutputsToWwwAsync;
43
49
  /** Function we use to get outputs of the whole job from steps. */
44
- function getJobOutputsFromSteps({ jobOutputDefinitions, interpolationContext, }) {
50
+ function collectJobOutputs({ jobOutputDefinitions, interpolationContext, }) {
45
51
  const jobOutputs = {};
46
52
  for (const [outputKey, outputDefinition] of Object.entries(jobOutputDefinitions)) {
47
53
  const outputValue = outputDefinition.replace(/\$\{\{(.+?)\}\}/g, (_match, expression) => {
@@ -52,12 +58,5 @@ function getJobOutputsFromSteps({ jobOutputDefinitions, interpolationContext, })
52
58
  }
53
59
  return jobOutputs;
54
60
  }
55
- exports.getJobOutputsFromSteps = getJobOutputsFromSteps;
56
- /** This is what we'll use to generate an object representing a step. */
57
- function getStepOutputsAsObject(step) {
58
- var _a;
59
- const outputs = Object.fromEntries((_a = Object.entries(step.outputById).map(([id, output]) => { var _a; return [id, (_a = output.value) !== null && _a !== void 0 ? _a : '']; })) !== null && _a !== void 0 ? _a : []);
60
- return { outputs };
61
- }
62
- exports.getStepOutputsAsObject = getStepOutputsAsObject;
61
+ exports.collectJobOutputs = collectJobOutputs;
63
62
  //# sourceMappingURL=outputs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"outputs.js","sourceRoot":"","sources":["../../src/utils/outputs.ts"],"names":[],"mappings":";;;;;;AACA,uCAAkD;AAElD,4DAAoC;AAIpC,+CAA4C;AAErC,KAAK,UAAU,0BAA0B,CAC9C,GAA8B,EAC9B,EACE,KAAK,EACL,MAAM,EACN,gBAAgB,GACiD;;IAEnE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACrB,MAAM,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAC;QACvD,OAAO;IACT,CAAC;IAED,IAAI,CAAC;QACH,MAAM,aAAa,GAAG,IAAA,oBAAU,EAAC,MAAA,MAAA,GAAG,CAAC,GAAG,CAAC,kBAAkB,0CAAE,GAAG,0CAAE,iBAAiB,CAAC,CAAC;QACrF,MAAM,gBAAgB,GAAG,IAAA,oBAAU,EAAC,MAAA,GAAG,CAAC,GAAG,CAAC,OAAO,0CAAE,gBAAgB,CAAC,CAAC;QAEvE,MAAM,oBAAoB,GAAG;YAC3B,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,sBAAsB,CAAC,IAAI,CAAC,CAAC,CAAC,CAA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C;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAnBD,wDAmBC;AAED,wEAAwE;AACxE,SAAgB,sBAAsB,CAAC,IAAe;;IAGpD,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAChC,MAAA,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,WAAC,OAAA,CAAC,EAAE,EAAE,MAAA,MAAM,CAAC,KAAK,mCAAI,EAAE,CAAC,CAAA,EAAA,CAAC,mCAAI,EAAE,CACtF,CAAC;IAEF,OAAO,EAAE,OAAO,EAAE,CAAC;AACrB,CAAC;AARD,wDAQC","sourcesContent":["import { Generic } from '@expo/eas-build-job';\nimport { BuildStep, jsepEval } from '@expo/steps';\nimport { bunyan } from '@expo/logger';\nimport nullthrows from 'nullthrows';\n\nimport { BuildContext } from '../context';\n\nimport { turtleFetch } from './turtleFetch';\n\nexport async function uploadJobOutputsToWwwAsync(\n ctx: BuildContext<Generic.Job>,\n {\n steps,\n logger,\n expoApiV2BaseUrl,\n }: { steps: BuildStep[]; logger: bunyan; expoApiV2BaseUrl: string }\n): Promise<void> {\n if (!ctx.job.outputs) {\n logger.info('Job defines no outputs, skipping upload');\n return;\n }\n\n try {\n const workflowJobId = nullthrows(ctx.job.builderEnvironment?.env?.__WORKFLOW_JOB_ID);\n const robotAccessToken = nullthrows(ctx.job.secrets?.robotAccessToken);\n\n const interpolationContext = {\n steps: Object.fromEntries(steps.map((step) => [step.id, getStepOutputsAsObject(step)])),\n };\n logger.debug({ dynamicValues: interpolationContext }, 'Using dynamic values');\n\n const outputs = getJobOutputsFromSteps({\n jobOutputDefinitions: ctx.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 getJobOutputsFromSteps({\n jobOutputDefinitions,\n interpolationContext,\n}: {\n jobOutputDefinitions: Record<string, string>;\n interpolationContext: {\n steps: Record<string, { outputs: Record<string, string | undefined> }>;\n };\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\n/** This is what we'll use to generate an object representing a step. */\nexport function getStepOutputsAsObject(step: BuildStep): {\n outputs: Record<string, string | undefined>;\n} {\n const outputs = Object.fromEntries(\n Object.entries(step.outputById).map(([id, output]) => [id, output.value ?? '']) ?? []\n );\n\n return { outputs };\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,CAA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ACpB,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 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 };\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.172",
3
+ "version": "1.0.174",
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.172",
28
+ "@expo/eas-build-job": "1.0.173",
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
33
  "@expo/repack-app": "0.0.6",
34
34
  "@expo/results": "^1.0.0",
35
- "@expo/steps": "1.0.172",
35
+ "@expo/steps": "1.0.173",
36
36
  "@expo/template-file": "1.0.117",
37
37
  "@expo/turtle-spawn": "1.0.117",
38
38
  "@expo/xcpretty": "^4.3.1",
@@ -75,5 +75,5 @@
75
75
  "node": "20.14.0",
76
76
  "yarn": "1.22.21"
77
77
  },
78
- "gitHead": "3fb33bcfe632cfa8e3a0e8fcceda82a8214c79c5"
78
+ "gitHead": "93fdc9272954e27375d4ce5fd9520cbcf5385717"
79
79
  }