diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a10fe065..bf9553dd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -139,7 +139,7 @@ jobs: run: npx -p publib@latest publib-npm - name: Update tags run: |- - version=`cat dist/version.txt` + version=`cat dist.old/version.txt` echo $version npm dist-tag add @mrgrain/cdk-esbuild@$version cdk-v2 env: diff --git a/projenrc/ReleaseBranches.ts b/projenrc/ReleaseBranches.ts index fa54f8e6..d3480bc3 100644 --- a/projenrc/ReleaseBranches.ts +++ b/projenrc/ReleaseBranches.ts @@ -26,7 +26,6 @@ export class StableReleases { public bind(project: typescript.TypeScriptProject) { new VersionsFile(project, { - currentBranch: this.currentBranch, versions: Object.fromEntries(Object.entries(this.branches).map(([version, info]) => [version, { minCdk: info.cdkVersion, @@ -116,7 +115,7 @@ export class StableReleases { return { name: 'Update tags', run: [ - 'version=`cat dist/version.txt`', + 'version=`cat dist.old/version.txt`', 'echo $version', ].concat(tags.map(tag => `npm dist-tag add ${project.package.packageName}@$version ${tag}`)).join('\n'), env: { diff --git a/projenrc/VersionsFile.ts b/projenrc/VersionsFile.ts index 455e399c..8ba34e44 100644 --- a/projenrc/VersionsFile.ts +++ b/projenrc/VersionsFile.ts @@ -3,7 +3,6 @@ import { Component, TextFile } from 'projen'; export interface VersionsFileOptions { path?: string; - currentBranch: string; versions: { [key: string]: { minCdk: string; @@ -16,11 +15,12 @@ export interface VersionsFileOptions { export class VersionsFile extends Component { public constructor(scope: IConstruct, { path = 'VERSIONS.md', - currentBranch, versions, }: VersionsFileOptions) { super(scope, `versions#${path}`); + const latestVersion = Object.keys(versions).sort().at(-1); + const table = Object.entries(versions).map(([version, info]) => { const base = `| ${version} | ^${info.minCdk} | >=${info.minNode} |`; @@ -55,9 +55,9 @@ ${table} | Tag | Description | Major version | Will the version change? | | ----------- | ---------------------------------------------------- | ------------- | ---------------------------- | -| \`latest\` | The latest stable release of the package | \`${currentBranch}\` | Yes, with new major versions | +| \`latest\` | The latest stable release of the package | \`${latestVersion}\` | Yes, with new major versions | | \`latest-v*\` | The latest stable release of each major version | n/a | No | -| \`cdk-v2\` | The latest stable release compatible with AWS CDK v2 | \`${currentBranch}\` | Yes, with new major versions | +| \`cdk-v2\` | The latest stable release compatible with AWS CDK v2 | \`${latestVersion}\` | Yes, with new major versions | | \`cdk-v1\` | The latest stable release compatible with AWS CDK v1 | \`v2\` | No | `.split('\n'), });