Skip to content

Commit

Permalink
fix: make sure release works for deprecated providers
Browse files Browse the repository at this point in the history
  • Loading branch information
xiehan committed Dec 19, 2023
1 parent fbad220 commit 8427e22
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,10 @@ export class CdktfProviderProject extends cdk.JsiiProject {
],
});

const releaseTask = this.tasks.tryFind("release")!;
if (!isDeprecated) {
new ShouldReleaseScriptFile(this, {});

const releaseTask = this.tasks.tryFind("release")!;
this.removeTask("release");
this.addTask("release", {
description: releaseTask.description,
Expand All @@ -420,6 +420,21 @@ export class CdktfProviderProject extends cdk.JsiiProject {
gitRemoteJob.name +=
" or cancel via faking a SHA if release was cancelled";
}
if (isDeprecated) {
// It's not clear to me why, but 'unbump' doesn't seem to have an effect and `npx projen release` fails
// This isn't a very elegant solution but I also don't feel like fighting Projen over an edge case
const releaseTaskSteps = releaseTask.steps;
releaseTaskSteps.splice(-1, 0, {
exec: "git checkout HEAD -- package.json",
});

this.removeTask("release");
this.addTask("release", {
description: releaseTask.description,
steps: releaseTaskSteps,
env: (releaseTask as any)._env,
});
}

// Submodule documentation generation
this.gitignore.exclude("API.md"); // ignore the old file, we now generate it in the docs folder
Expand Down
3 changes: 3 additions & 0 deletions test/__snapshots__/index.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8427e22

Please sign in to comment.