Skip to content

Commit

Permalink
feat(eas-cli): Add --dry-run flag to deploy command (#2761)
Browse files Browse the repository at this point in the history
* Add dry-run option to deploy command

* Add `--dry-run` flag to deploy command

* Update CHANGELOG
  • Loading branch information
kitten authored Dec 11, 2024
1 parent 8d35745 commit 17661d1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ This is the log of notable changes to EAS CLI and related packages.

### 🎉 New features

- Add `eas deploy --dry-run` flag to output tarball. ([#2761](https://github.com/expo/eas-cli/pull/2761) by [@kitten](https://github.com/kitten))

### 🐛 Bug fixes

- Remove random branch name generation for --auto branch name non-vcs fallback. ([#2747](https://github.com/expo/eas-cli/pull/2747) by [@wschurman](https://github.com/wschurman))
Expand Down
17 changes: 17 additions & 0 deletions packages/eas-cli/src/commands/worker/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ interface DeployFlags {
environment?: EnvironmentVariableEnvironment;
deploymentIdentifier?: string;
exportDir: string;
dryRun: boolean;
}

interface RawDeployFlags {
Expand All @@ -53,6 +54,7 @@ interface RawDeployFlags {
alias?: string;
id?: string;
'export-dir': string;
'dry-run': boolean;
}

interface DeployInProgressParams {
Expand Down Expand Up @@ -90,6 +92,10 @@ export default class WorkerDeploy extends EasCommand {
helpValue: 'dir',
default: 'dist',
}),
'dry-run': Flags.boolean({
description: 'Outputs a tarball of the new deployment instead of uploading it.',
default: false,
}),
environment: {
...EASEnvironmentFlag.environment,
description: 'Deploy with EAS Environment Variables matching the specified environment.',
Expand Down Expand Up @@ -268,6 +274,16 @@ export default class WorkerDeploy extends EasCommand {
})
);

if (flags.dryRun) {
const DRY_RUN_OUTPUT_PATH = 'deploy.tar.gz';
await fs.promises.copyFile(tarPath, DRY_RUN_OUTPUT_PATH);
progress.succeed('Saved deploy.tar.gz tarball');
if (flags.json) {
printJsonOnlyOutput({ tarPath: DRY_RUN_OUTPUT_PATH });
}
return;
}

const uploadUrl = await getSignedDeploymentUrlAsync(graphqlClient, {
appId: projectId,
deploymentIdentifier: flags.deploymentIdentifier,
Expand Down Expand Up @@ -382,6 +398,7 @@ export default class WorkerDeploy extends EasCommand {
aliasName: flags.alias?.trim().toLowerCase(),
deploymentIdentifier: flags.id?.trim(),
exportDir: flags['export-dir'],
dryRun: flags['dry-run'],
};
}
}
Expand Down

0 comments on commit 17661d1

Please sign in to comment.