Skip to content

Commit

Permalink
[build-tools] Do not add repack.yml to project directory (#496)
Browse files Browse the repository at this point in the history
# Why

If developers have `requireCommit: true` in their `eas.json` configuration, when they try to publish an update with Workflows it fails, because there are uncommitted files in repository — `__eas/repack.yml`.

# How

Instead of copying `repack.yml` into people's projects we're going to define `steps` in code.

# Test Plan

Tested manually.
  • Loading branch information
sjchmiela authored Jan 24, 2025
1 parent 0838ac1 commit b4ccf21
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 40 deletions.
18 changes: 0 additions & 18 deletions packages/build-tools/resources/__eas/repack.yml

This file was deleted.

2 changes: 0 additions & 2 deletions packages/build-tools/src/builders/custom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ import { CustomBuildContext } from '../customBuildContext';
import { resolveEnvFromBuildProfileAsync } from '../common/easBuildInternal';
import { getEasFunctionGroups } from '../steps/easFunctionGroups';
import { findAndUploadXcodeBuildLogsAsync } from '../ios/xcodeBuildLogs';
import { addEasWorkflows } from '../generic';

export async function runCustomBuildAsync(ctx: BuildContext<BuildJob>): Promise<Artifacts> {
const customBuildCtx = new CustomBuildContext(ctx);
await addEasWorkflows(customBuildCtx);
await prepareProjectSourcesAsync(ctx, customBuildCtx.projectSourceDirectory);
if (ctx.job.triggeredBy === BuildTrigger.GIT_BASED_INTEGRATION) {
// We need to setup envs from eas.json
Expand Down
20 changes: 17 additions & 3 deletions packages/build-tools/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,23 @@ export class BuildContext<TJob extends Job = Job> {
...job,
...(shouldApplyRepackOverrides
? {
customBuildConfig: {
path: '__eas/repack.yml',
},
steps: [
{ uses: 'eas/checkout' },
{ uses: 'eas/install_node_modules' },
{ uses: 'eas/resolve_build_config' },
{
uses: 'eas/__download_and_repack_golden_development_client_archive',
id: 'download_and_repack_golden_development_client_archive',
},
{
uses: 'eas/upload_artifact',
name: 'Upload build artifact',
with: {
type: 'application-archive',
path: '${ steps.download_and_repack_golden_development_client_archive.repacked_archive_path }',
},
},
],
}
: null),
};
Expand Down
17 changes: 0 additions & 17 deletions packages/build-tools/src/generic.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import fs from 'fs';
import path from 'path';

import { BuildPhase, Generic } from '@expo/eas-build-job';
import { BuildStepGlobalContext, BuildWorkflow, errors, StepsConfigParser } from '@expo/steps';
import { Result, asyncResult } from '@expo/results';
Expand All @@ -20,8 +17,6 @@ export async function runGenericJobAsync(

await prepareProjectSourcesAsync(ctx, customBuildCtx.projectSourceDirectory);

await addEasWorkflows(customBuildCtx);

const globalContext = new BuildStepGlobalContext(customBuildCtx, false);

const parser = new StepsConfigParser(globalContext, {
Expand Down Expand Up @@ -56,15 +51,3 @@ export async function runGenericJobAsync(

return { runResult, buildWorkflow: workflow };
}

export async function addEasWorkflows(customBuildCtx: CustomBuildContext): Promise<void> {
await fs.promises.mkdir(path.join(customBuildCtx.projectSourceDirectory, '__eas'), {
recursive: true,
});

await fs.promises.cp(
path.join(__dirname, '..', 'resources', '__eas'),
path.join(customBuildCtx.projectSourceDirectory, '__eas'),
{ recursive: true }
);
}

0 comments on commit b4ccf21

Please sign in to comment.