From 78bf2e41075b74541f6706dd563acf874a6e53ad Mon Sep 17 00:00:00 2001 From: Elad Ben-Israel Date: Fri, 10 Dec 2021 01:09:20 +0200 Subject: [PATCH] feat(release): allow specifying npm dist-tag per branch (#1314) Adds `npmDistTag` to release branch definition which will be configured in the release workflow triggered for this branch. Implementation notes: to support this we needed to refactor the publisher so that when its jobs are rendered, they have the branch context. This also means that now we can ensire that when a publish command is executed manually, it will be done only on the correct release branch. The root `npmDistTag` setting applies to the default branch. BREAKING CHANGE: `npmDistTag` only effects publishing (and supported for each release branch) setting and so it is no longer set in `package.json`. * `workflow.addJobsLater()` is no longer supported. Use `postSynthesis` hooks and call `.addJobs()` as needed. * `publish:xxxx` tasks for automated releases are not defined by default since normally they should only be executed from within workflows. Set `publishingTasks: true` to create them. --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. --- .projen/tasks.json | 62 ---- API.md | 152 +++++---- package.json | 4 - src/cdk/jsii-project.ts | 1 - src/github/workflows.ts | 24 +- src/javascript/node-package.ts | 29 +- src/javascript/node-project.ts | 14 - src/release/publisher.ts | 289 +++++++++++------- src/release/release.ts | 95 ++++-- test/__snapshots__/integ.test.ts.snap | 78 ----- test/__snapshots__/inventory.test.ts.snap | 273 +++++++++++++++-- test/jsii.test.ts | 24 +- test/node-project.test.ts | 4 - .../__snapshots__/release.test.ts.snap | 235 +++++++++++++- test/release/release.test.ts | 136 +++++++++ .../__snapshots__/nextjs-project.test.ts.snap | 15 - .../__snapshots__/react-project.test.ts.snap | 15 - 17 files changed, 960 insertions(+), 490 deletions(-) diff --git a/.projen/tasks.json b/.projen/tasks.json index e1be0017279..8a10807909f 100644 --- a/.projen/tasks.json +++ b/.projen/tasks.json @@ -181,68 +181,6 @@ "name": "pre-compile", "description": "Prepare the project for compilation" }, - "publish:github": { - "name": "publish:github", - "description": "Publish this package to GitHub Releases", - "requiredEnv": [ - "GITHUB_TOKEN", - "GITHUB_REPOSITORY", - "GITHUB_REF" - ], - "steps": [ - { - "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \"Release.tag_name already exists\" $errout; then cat $errout; exit $exitcode; fi" - } - ] - }, - "publish:maven": { - "name": "publish:maven", - "description": "Publish this package to Maven Central", - "env": { - "MAVEN_ENDPOINT": "https://s01.oss.sonatype.org" - }, - "requiredEnv": [ - "MAVEN_GPG_PRIVATE_KEY", - "MAVEN_GPG_PRIVATE_KEY_PASSPHRASE", - "MAVEN_PASSWORD", - "MAVEN_USERNAME", - "MAVEN_STAGING_PROFILE_ID" - ], - "steps": [ - { - "exec": "npx -p jsii-release@latest jsii-release-maven" - } - ] - }, - "publish:npm": { - "name": "publish:npm", - "description": "Publish this package to npm", - "env": { - "NPM_DIST_TAG": "latest", - "NPM_REGISTRY": "registry.npmjs.org" - }, - "requiredEnv": [ - "NPM_TOKEN" - ], - "steps": [ - { - "exec": "npx -p jsii-release@latest jsii-release-npm" - } - ] - }, - "publish:pypi": { - "name": "publish:pypi", - "description": "Publish this package to PyPI", - "requiredEnv": [ - "TWINE_USERNAME", - "TWINE_PASSWORD" - ], - "steps": [ - { - "exec": "npx -p jsii-release@latest jsii-release-pypi" - } - ] - }, "readme-macros": { "name": "readme-macros", "steps": [ diff --git a/API.md b/API.md index 96b40e5fffc..756c7b4356e 100644 --- a/API.md +++ b/API.md @@ -2923,7 +2923,6 @@ new awscdk.AwsCdkConstructLibrary(options: AwsCdkConstructLibraryOptions) * **maxNodeVersion** (string) Minimum node.js version to require via `engines` (inclusive). __*Default*__: no max * **minNodeVersion** (string) Minimum Node.js version to require via package.json `engines` (inclusive). __*Default*__: no "engines" specified * **npmAccess** ([javascript.NpmAccess](#projen-javascript-npmaccess)) Access level of the npm package. __*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. - * **npmDistTag** (string) Tags can be used to provide an alias instead of version numbers. __*Default*__: "latest" * **npmRegistry** (string) The host name of the npm registry to publish to. __*Optional*__ * **npmRegistryUrl** (string) The base URL of the npm package registry. __*Default*__: "https://registry.npmjs.org" * **npmTokenSecret** (string) GitHub secret which contains the NPM token to use when publishing packages. __*Default*__: "NPM_TOKEN" @@ -2939,8 +2938,10 @@ new awscdk.AwsCdkConstructLibrary(options: AwsCdkConstructLibraryOptions) * **artifactsDirectory** (string) A directory which will contain artifacts to be published to npm. __*Default*__: "dist" * **jsiiReleaseVersion** (string) Version requirement of `jsii-release` which is used to publish modules to npm. __*Default*__: "latest" * **majorVersion** (number) Major version to release from the default branch. __*Default*__: Major version is not enforced. + * **npmDistTag** (string) The npmDistTag to use when publishing from the default branch. __*Default*__: "latest" * **postBuildSteps** (Array<[github.workflows.JobStep](#projen-github-workflows-jobstep)>) Steps to execute after build as part of the release workflow. __*Default*__: [] * **prerelease** (string) Bump versions from the default branch as pre-releases (e.g. "beta", "alpha", "pre"). __*Default*__: normal semantic versions + * **publishTasks** (boolean) Define publishing tasks that can be executed manually as well as workflows. __*Default*__: false * **releaseBranches** (Map) Defines additional release branches. __*Default*__: no additional branches are used for release. you can use `addBranch()` to add additional branches. * **releaseEveryCommit** (boolean) Automatically release new versions every commit to one of branches in `releaseBranches`. __*Default*__: true * **releaseFailureIssue** (boolean) Create a github issue on every failed publishing task. __*Default*__: false @@ -3236,7 +3237,6 @@ new awscdk.AwsCdkTypeScriptApp(options: AwsCdkTypeScriptAppOptions) * **maxNodeVersion** (string) Minimum node.js version to require via `engines` (inclusive). __*Default*__: no max * **minNodeVersion** (string) Minimum Node.js version to require via package.json `engines` (inclusive). __*Default*__: no "engines" specified * **npmAccess** ([javascript.NpmAccess](#projen-javascript-npmaccess)) Access level of the npm package. __*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. - * **npmDistTag** (string) Tags can be used to provide an alias instead of version numbers. __*Default*__: "latest" * **npmRegistry** (string) The host name of the npm registry to publish to. __*Optional*__ * **npmRegistryUrl** (string) The base URL of the npm package registry. __*Default*__: "https://registry.npmjs.org" * **npmTokenSecret** (string) GitHub secret which contains the NPM token to use when publishing packages. __*Default*__: "NPM_TOKEN" @@ -3252,8 +3252,10 @@ new awscdk.AwsCdkTypeScriptApp(options: AwsCdkTypeScriptAppOptions) * **artifactsDirectory** (string) A directory which will contain artifacts to be published to npm. __*Default*__: "dist" * **jsiiReleaseVersion** (string) Version requirement of `jsii-release` which is used to publish modules to npm. __*Default*__: "latest" * **majorVersion** (number) Major version to release from the default branch. __*Default*__: Major version is not enforced. + * **npmDistTag** (string) The npmDistTag to use when publishing from the default branch. __*Default*__: "latest" * **postBuildSteps** (Array<[github.workflows.JobStep](#projen-github-workflows-jobstep)>) Steps to execute after build as part of the release workflow. __*Default*__: [] * **prerelease** (string) Bump versions from the default branch as pre-releases (e.g. "beta", "alpha", "pre"). __*Default*__: normal semantic versions + * **publishTasks** (boolean) Define publishing tasks that can be executed manually as well as workflows. __*Default*__: false * **releaseBranches** (Map) Defines additional release branches. __*Default*__: no additional branches are used for release. you can use `addBranch()` to add additional branches. * **releaseEveryCommit** (boolean) Automatically release new versions every commit to one of branches in `releaseBranches`. __*Default*__: true * **releaseFailureIssue** (boolean) Create a github issue on every failed publishing task. __*Default*__: false @@ -3491,7 +3493,6 @@ new awscdk.ConstructLibraryAws(options: AwsCdkConstructLibraryOptions) * **maxNodeVersion** (string) Minimum node.js version to require via `engines` (inclusive). __*Default*__: no max * **minNodeVersion** (string) Minimum Node.js version to require via package.json `engines` (inclusive). __*Default*__: no "engines" specified * **npmAccess** ([javascript.NpmAccess](#projen-javascript-npmaccess)) Access level of the npm package. __*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. - * **npmDistTag** (string) Tags can be used to provide an alias instead of version numbers. __*Default*__: "latest" * **npmRegistry** (string) The host name of the npm registry to publish to. __*Optional*__ * **npmRegistryUrl** (string) The base URL of the npm package registry. __*Default*__: "https://registry.npmjs.org" * **npmTokenSecret** (string) GitHub secret which contains the NPM token to use when publishing packages. __*Default*__: "NPM_TOKEN" @@ -3507,8 +3508,10 @@ new awscdk.ConstructLibraryAws(options: AwsCdkConstructLibraryOptions) * **artifactsDirectory** (string) A directory which will contain artifacts to be published to npm. __*Default*__: "dist" * **jsiiReleaseVersion** (string) Version requirement of `jsii-release` which is used to publish modules to npm. __*Default*__: "latest" * **majorVersion** (number) Major version to release from the default branch. __*Default*__: Major version is not enforced. + * **npmDistTag** (string) The npmDistTag to use when publishing from the default branch. __*Default*__: "latest" * **postBuildSteps** (Array<[github.workflows.JobStep](#projen-github-workflows-jobstep)>) Steps to execute after build as part of the release workflow. __*Default*__: [] * **prerelease** (string) Bump versions from the default branch as pre-releases (e.g. "beta", "alpha", "pre"). __*Default*__: normal semantic versions + * **publishTasks** (boolean) Define publishing tasks that can be executed manually as well as workflows. __*Default*__: false * **releaseBranches** (Map) Defines additional release branches. __*Default*__: no additional branches are used for release. you can use `addBranch()` to add additional branches. * **releaseEveryCommit** (boolean) Automatically release new versions every commit to one of branches in `releaseBranches`. __*Default*__: true * **releaseFailureIssue** (boolean) Create a github issue on every failed publishing task. __*Default*__: false @@ -3758,7 +3761,6 @@ new cdk.ConstructLibrary(options: ConstructLibraryOptions) * **maxNodeVersion** (string) Minimum node.js version to require via `engines` (inclusive). __*Default*__: no max * **minNodeVersion** (string) Minimum Node.js version to require via package.json `engines` (inclusive). __*Default*__: no "engines" specified * **npmAccess** ([javascript.NpmAccess](#projen-javascript-npmaccess)) Access level of the npm package. __*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. - * **npmDistTag** (string) Tags can be used to provide an alias instead of version numbers. __*Default*__: "latest" * **npmRegistry** (string) The host name of the npm registry to publish to. __*Optional*__ * **npmRegistryUrl** (string) The base URL of the npm package registry. __*Default*__: "https://registry.npmjs.org" * **npmTokenSecret** (string) GitHub secret which contains the NPM token to use when publishing packages. __*Default*__: "NPM_TOKEN" @@ -3774,8 +3776,10 @@ new cdk.ConstructLibrary(options: ConstructLibraryOptions) * **artifactsDirectory** (string) A directory which will contain artifacts to be published to npm. __*Default*__: "dist" * **jsiiReleaseVersion** (string) Version requirement of `jsii-release` which is used to publish modules to npm. __*Default*__: "latest" * **majorVersion** (number) Major version to release from the default branch. __*Default*__: Major version is not enforced. + * **npmDistTag** (string) The npmDistTag to use when publishing from the default branch. __*Default*__: "latest" * **postBuildSteps** (Array<[github.workflows.JobStep](#projen-github-workflows-jobstep)>) Steps to execute after build as part of the release workflow. __*Default*__: [] * **prerelease** (string) Bump versions from the default branch as pre-releases (e.g. "beta", "alpha", "pre"). __*Default*__: normal semantic versions + * **publishTasks** (boolean) Define publishing tasks that can be executed manually as well as workflows. __*Default*__: false * **releaseBranches** (Map) Defines additional release branches. __*Default*__: no additional branches are used for release. you can use `addBranch()` to add additional branches. * **releaseEveryCommit** (boolean) Automatically release new versions every commit to one of branches in `releaseBranches`. __*Default*__: true * **releaseFailureIssue** (boolean) Create a github issue on every failed publishing task. __*Default*__: false @@ -3937,7 +3941,6 @@ new cdk.JsiiProject(options: JsiiProjectOptions) * **maxNodeVersion** (string) Minimum node.js version to require via `engines` (inclusive). __*Default*__: no max * **minNodeVersion** (string) Minimum Node.js version to require via package.json `engines` (inclusive). __*Default*__: no "engines" specified * **npmAccess** ([javascript.NpmAccess](#projen-javascript-npmaccess)) Access level of the npm package. __*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. - * **npmDistTag** (string) Tags can be used to provide an alias instead of version numbers. __*Default*__: "latest" * **npmRegistry** (string) The host name of the npm registry to publish to. __*Optional*__ * **npmRegistryUrl** (string) The base URL of the npm package registry. __*Default*__: "https://registry.npmjs.org" * **npmTokenSecret** (string) GitHub secret which contains the NPM token to use when publishing packages. __*Default*__: "NPM_TOKEN" @@ -3953,8 +3956,10 @@ new cdk.JsiiProject(options: JsiiProjectOptions) * **artifactsDirectory** (string) A directory which will contain artifacts to be published to npm. __*Default*__: "dist" * **jsiiReleaseVersion** (string) Version requirement of `jsii-release` which is used to publish modules to npm. __*Default*__: "latest" * **majorVersion** (number) Major version to release from the default branch. __*Default*__: Major version is not enforced. + * **npmDistTag** (string) The npmDistTag to use when publishing from the default branch. __*Default*__: "latest" * **postBuildSteps** (Array<[github.workflows.JobStep](#projen-github-workflows-jobstep)>) Steps to execute after build as part of the release workflow. __*Default*__: [] * **prerelease** (string) Bump versions from the default branch as pre-releases (e.g. "beta", "alpha", "pre"). __*Default*__: normal semantic versions + * **publishTasks** (boolean) Define publishing tasks that can be executed manually as well as workflows. __*Default*__: false * **releaseBranches** (Map) Defines additional release branches. __*Default*__: no additional branches are used for release. you can use `addBranch()` to add additional branches. * **releaseEveryCommit** (boolean) Automatically release new versions every commit to one of branches in `releaseBranches`. __*Default*__: true * **releaseFailureIssue** (boolean) Create a github issue on every failed publishing task. __*Default*__: false @@ -4102,7 +4107,6 @@ new cdk8s.Cdk8sTypeScriptApp(options: Cdk8sTypeScriptAppOptions) * **maxNodeVersion** (string) Minimum node.js version to require via `engines` (inclusive). __*Default*__: no max * **minNodeVersion** (string) Minimum Node.js version to require via package.json `engines` (inclusive). __*Default*__: no "engines" specified * **npmAccess** ([javascript.NpmAccess](#projen-javascript-npmaccess)) Access level of the npm package. __*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. - * **npmDistTag** (string) Tags can be used to provide an alias instead of version numbers. __*Default*__: "latest" * **npmRegistry** (string) The host name of the npm registry to publish to. __*Optional*__ * **npmRegistryUrl** (string) The base URL of the npm package registry. __*Default*__: "https://registry.npmjs.org" * **npmTokenSecret** (string) GitHub secret which contains the NPM token to use when publishing packages. __*Default*__: "NPM_TOKEN" @@ -4118,8 +4122,10 @@ new cdk8s.Cdk8sTypeScriptApp(options: Cdk8sTypeScriptAppOptions) * **artifactsDirectory** (string) A directory which will contain artifacts to be published to npm. __*Default*__: "dist" * **jsiiReleaseVersion** (string) Version requirement of `jsii-release` which is used to publish modules to npm. __*Default*__: "latest" * **majorVersion** (number) Major version to release from the default branch. __*Default*__: Major version is not enforced. + * **npmDistTag** (string) The npmDistTag to use when publishing from the default branch. __*Default*__: "latest" * **postBuildSteps** (Array<[github.workflows.JobStep](#projen-github-workflows-jobstep)>) Steps to execute after build as part of the release workflow. __*Default*__: [] * **prerelease** (string) Bump versions from the default branch as pre-releases (e.g. "beta", "alpha", "pre"). __*Default*__: normal semantic versions + * **publishTasks** (boolean) Define publishing tasks that can be executed manually as well as workflows. __*Default*__: false * **releaseBranches** (Map) Defines additional release branches. __*Default*__: no additional branches are used for release. you can use `addBranch()` to add additional branches. * **releaseEveryCommit** (boolean) Automatically release new versions every commit to one of branches in `releaseBranches`. __*Default*__: true * **releaseFailureIssue** (boolean) Create a github issue on every failed publishing task. __*Default*__: false @@ -4269,7 +4275,6 @@ new cdk8s.ConstructLibraryCdk8s(options: ConstructLibraryCdk8sOptions) * **maxNodeVersion** (string) Minimum node.js version to require via `engines` (inclusive). __*Default*__: no max * **minNodeVersion** (string) Minimum Node.js version to require via package.json `engines` (inclusive). __*Default*__: no "engines" specified * **npmAccess** ([javascript.NpmAccess](#projen-javascript-npmaccess)) Access level of the npm package. __*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. - * **npmDistTag** (string) Tags can be used to provide an alias instead of version numbers. __*Default*__: "latest" * **npmRegistry** (string) The host name of the npm registry to publish to. __*Optional*__ * **npmRegistryUrl** (string) The base URL of the npm package registry. __*Default*__: "https://registry.npmjs.org" * **npmTokenSecret** (string) GitHub secret which contains the NPM token to use when publishing packages. __*Default*__: "NPM_TOKEN" @@ -4285,8 +4290,10 @@ new cdk8s.ConstructLibraryCdk8s(options: ConstructLibraryCdk8sOptions) * **artifactsDirectory** (string) A directory which will contain artifacts to be published to npm. __*Default*__: "dist" * **jsiiReleaseVersion** (string) Version requirement of `jsii-release` which is used to publish modules to npm. __*Default*__: "latest" * **majorVersion** (number) Major version to release from the default branch. __*Default*__: Major version is not enforced. + * **npmDistTag** (string) The npmDistTag to use when publishing from the default branch. __*Default*__: "latest" * **postBuildSteps** (Array<[github.workflows.JobStep](#projen-github-workflows-jobstep)>) Steps to execute after build as part of the release workflow. __*Default*__: [] * **prerelease** (string) Bump versions from the default branch as pre-releases (e.g. "beta", "alpha", "pre"). __*Default*__: normal semantic versions + * **publishTasks** (boolean) Define publishing tasks that can be executed manually as well as workflows. __*Default*__: false * **releaseBranches** (Map) Defines additional release branches. __*Default*__: no additional branches are used for release. you can use `addBranch()` to add additional branches. * **releaseEveryCommit** (boolean) Automatically release new versions every commit to one of branches in `releaseBranches`. __*Default*__: true * **releaseFailureIssue** (boolean) Create a github issue on every failed publishing task. __*Default*__: false @@ -4445,7 +4452,6 @@ new cdktf.ConstructLibraryCdktf(options: ConstructLibraryCdktfOptions) * **maxNodeVersion** (string) Minimum node.js version to require via `engines` (inclusive). __*Default*__: no max * **minNodeVersion** (string) Minimum Node.js version to require via package.json `engines` (inclusive). __*Default*__: no "engines" specified * **npmAccess** ([javascript.NpmAccess](#projen-javascript-npmaccess)) Access level of the npm package. __*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. - * **npmDistTag** (string) Tags can be used to provide an alias instead of version numbers. __*Default*__: "latest" * **npmRegistry** (string) The host name of the npm registry to publish to. __*Optional*__ * **npmRegistryUrl** (string) The base URL of the npm package registry. __*Default*__: "https://registry.npmjs.org" * **npmTokenSecret** (string) GitHub secret which contains the NPM token to use when publishing packages. __*Default*__: "NPM_TOKEN" @@ -4461,8 +4467,10 @@ new cdktf.ConstructLibraryCdktf(options: ConstructLibraryCdktfOptions) * **artifactsDirectory** (string) A directory which will contain artifacts to be published to npm. __*Default*__: "dist" * **jsiiReleaseVersion** (string) Version requirement of `jsii-release` which is used to publish modules to npm. __*Default*__: "latest" * **majorVersion** (number) Major version to release from the default branch. __*Default*__: Major version is not enforced. + * **npmDistTag** (string) The npmDistTag to use when publishing from the default branch. __*Default*__: "latest" * **postBuildSteps** (Array<[github.workflows.JobStep](#projen-github-workflows-jobstep)>) Steps to execute after build as part of the release workflow. __*Default*__: [] * **prerelease** (string) Bump versions from the default branch as pre-releases (e.g. "beta", "alpha", "pre"). __*Default*__: normal semantic versions + * **publishTasks** (boolean) Define publishing tasks that can be executed manually as well as workflows. __*Default*__: false * **releaseBranches** (Map) Defines additional release branches. __*Default*__: no additional branches are used for release. you can use `addBranch()` to add additional branches. * **releaseEveryCommit** (boolean) Automatically release new versions every commit to one of branches in `releaseBranches`. __*Default*__: true * **releaseFailureIssue** (boolean) Create a github issue on every failed publishing task. __*Default*__: false @@ -4900,22 +4908,6 @@ addJobs(jobs: Map): void -#### addJobsLater(provider)🔹 - -Add jobs from a dynamic source. - -Useful if a component creates jobs that -may not be all available until project synthesis time. - -```ts -addJobsLater(provider: IJobProvider): void -``` - -* **provider** ([github.IJobProvider](#projen-github-ijobprovider)) Source of jobs. - - - - #### on(events)🔹 Add events to triggers the workflow. @@ -5861,7 +5853,6 @@ new javascript.NodePackage(project: Project, options?: NodePackageOptions) * **maxNodeVersion** (string) Minimum node.js version to require via `engines` (inclusive). __*Default*__: no max * **minNodeVersion** (string) Minimum Node.js version to require via package.json `engines` (inclusive). __*Default*__: no "engines" specified * **npmAccess** ([javascript.NpmAccess](#projen-javascript-npmaccess)) Access level of the npm package. __*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. - * **npmDistTag** (string) Tags can be used to provide an alias instead of version numbers. __*Default*__: "latest" * **npmRegistry** (string) The host name of the npm registry to publish to. __*Optional*__ * **npmRegistryUrl** (string) The base URL of the npm package registry. __*Default*__: "https://registry.npmjs.org" * **npmTokenSecret** (string) GitHub secret which contains the NPM token to use when publishing packages. __*Default*__: "NPM_TOKEN" @@ -5888,7 +5879,6 @@ Name | Type | Description **lockFile**🔹 | string | The name of the lock file. **manifest**⚠️ | any | **npmAccess**🔹 | [javascript.NpmAccess](#projen-javascript-npmaccess) | npm package access level. -**npmDistTag**🔹 | string | npm distribution tag. **npmRegistry**🔹 | string | The npm registry host (e.g. `registry.npmjs.org`). **npmRegistryUrl**🔹 | string | npm registry (e.g. `https://registry.npmjs.org`). Use `npmRegistryHost` to get just the host name. **packageManager**🔹 | [javascript.NodePackageManager](#projen-javascript-nodepackagemanager) | The package manager to use. @@ -6170,7 +6160,6 @@ new javascript.NodeProject(options: NodeProjectOptions) * **maxNodeVersion** (string) Minimum node.js version to require via `engines` (inclusive). __*Default*__: no max * **minNodeVersion** (string) Minimum Node.js version to require via package.json `engines` (inclusive). __*Default*__: no "engines" specified * **npmAccess** ([javascript.NpmAccess](#projen-javascript-npmaccess)) Access level of the npm package. __*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. - * **npmDistTag** (string) Tags can be used to provide an alias instead of version numbers. __*Default*__: "latest" * **npmRegistry** (string) The host name of the npm registry to publish to. __*Optional*__ * **npmRegistryUrl** (string) The base URL of the npm package registry. __*Default*__: "https://registry.npmjs.org" * **npmTokenSecret** (string) GitHub secret which contains the NPM token to use when publishing packages. __*Default*__: "NPM_TOKEN" @@ -6186,8 +6175,10 @@ new javascript.NodeProject(options: NodeProjectOptions) * **artifactsDirectory** (string) A directory which will contain artifacts to be published to npm. __*Default*__: "dist" * **jsiiReleaseVersion** (string) Version requirement of `jsii-release` which is used to publish modules to npm. __*Default*__: "latest" * **majorVersion** (number) Major version to release from the default branch. __*Default*__: Major version is not enforced. + * **npmDistTag** (string) The npmDistTag to use when publishing from the default branch. __*Default*__: "latest" * **postBuildSteps** (Array<[github.workflows.JobStep](#projen-github-workflows-jobstep)>) Steps to execute after build as part of the release workflow. __*Default*__: [] * **prerelease** (string) Bump versions from the default branch as pre-releases (e.g. "beta", "alpha", "pre"). __*Default*__: normal semantic versions + * **publishTasks** (boolean) Define publishing tasks that can be executed manually as well as workflows. __*Default*__: false * **releaseBranches** (Map) Defines additional release branches. __*Default*__: no additional branches are used for release. you can use `addBranch()` to add additional branches. * **releaseEveryCommit** (boolean) Automatically release new versions every commit to one of branches in `releaseBranches`. __*Default*__: true * **releaseFailureIssue** (boolean) Create a github issue on every failed publishing task. __*Default*__: false @@ -6248,8 +6239,6 @@ Name | Type | Description **entrypoint**⚠️ | string | **installWorkflowSteps**🔹 | Array<[github.workflows.JobStep](#projen-github-workflows-jobstep)> | **manifest**⚠️ | any | -**npmDistTag**⚠️ | string | -**npmRegistry**⚠️ | string | **package**🔹 | [javascript.NodePackage](#projen-javascript-nodepackage) | API for managing the node package. **packageManager**⚠️ | [javascript.NodePackageManager](#projen-javascript-nodepackagemanager) | The package manager to use. **runScriptCommand**🔹 | string | The command to use to run scripts (e.g. `yarn run` or `npm run` depends on the package manager). @@ -7315,7 +7304,6 @@ Implements GitHub jobs for publishing modules to package managers. Under the hood, it uses https://github.com/aws/jsii-release -__Implements__: [github.IJobProvider](#projen-github-ijobprovider) __Submodule__: release __Extends__: [Component](#projen-component) @@ -7337,6 +7325,7 @@ new release.Publisher(project: Project, options: PublisherOptions) * **failureIssue** (boolean) Create an issue when a publish task fails. __*Default*__: false * **failureIssueLabel** (string) The label to apply to the issue marking failed publish tasks. __*Default*__: "failed-release" * **jsiiReleaseVersion** (string) Version requirement for `jsii-release`. __*Default*__: "latest" + * **publishTasks** (boolean) Define publishing tasks that can be executed manually as well as workflows. __*Default*__: false * **workflowRunsOn** (Array) Github Runner selection labels. __*Default*__: ["ubuntu-latest"] @@ -7478,18 +7467,6 @@ publishToPyPi(options?: PyPiPublishOptions): void -#### renderJobs()🔹 - -Renders a set of workflow jobs for all the publishers. - -```ts -renderJobs(): Map -``` - - -__Returns__: -* Map - ## class Release 🔹 @@ -7517,8 +7494,10 @@ new release.Release(project: GitHubProject, options: ReleaseOptions) * **artifactsDirectory** (string) A directory which will contain artifacts to be published to npm. __*Default*__: "dist" * **jsiiReleaseVersion** (string) Version requirement of `jsii-release` which is used to publish modules to npm. __*Default*__: "latest" * **majorVersion** (number) Major version to release from the default branch. __*Default*__: Major version is not enforced. + * **npmDistTag** (string) The npmDistTag to use when publishing from the default branch. __*Default*__: "latest" * **postBuildSteps** (Array<[github.workflows.JobStep](#projen-github-workflows-jobstep)>) Steps to execute after build as part of the release workflow. __*Default*__: [] * **prerelease** (string) Bump versions from the default branch as pre-releases (e.g. "beta", "alpha", "pre"). __*Default*__: normal semantic versions + * **publishTasks** (boolean) Define publishing tasks that can be executed manually as well as workflows. __*Default*__: false * **releaseBranches** (Map) Defines additional release branches. __*Default*__: no additional branches are used for release. you can use `addBranch()` to add additional branches. * **releaseEveryCommit** (boolean) Automatically release new versions every commit to one of branches in `releaseBranches`. __*Default*__: true * **releaseFailureIssue** (boolean) Create a github issue on every failed publishing task. __*Default*__: false @@ -7564,6 +7543,7 @@ addBranch(branch: string, options: BranchOptions): void * **branch** (string) The branch to monitor (e.g. `main`, `v2.x`). * **options** ([release.BranchOptions](#projen-release-branchoptions)) Branch definition. * **majorVersion** (number) The major versions released from this branch. + * **npmDistTag** (string) The npm distribution tag to use for this branch. __*Default*__: "latest" * **prerelease** (string) Bump the version as a pre-release tag. __*Default*__: normal releases * **tagPrefix** (string) Automatically add the given prefix to release tags. Useful if you are releasing on multiple branches with overlapping version numbers. __*Default*__: no prefix * **workflowName** (string) The name of the release workflow. __*Default*__: "release-BRANCH" @@ -7584,6 +7564,18 @@ addJobs(jobs: Map): void +#### preSynthesize()🔹 + +Called before synthesis. + +```ts +preSynthesize(): void +``` + + + + + ## class ReleaseTrigger 🔹 @@ -7755,7 +7747,6 @@ new typescript.TypeScriptAppProject(options: TypeScriptProjectOptions) * **maxNodeVersion** (string) Minimum node.js version to require via `engines` (inclusive). __*Default*__: no max * **minNodeVersion** (string) Minimum Node.js version to require via package.json `engines` (inclusive). __*Default*__: no "engines" specified * **npmAccess** ([javascript.NpmAccess](#projen-javascript-npmaccess)) Access level of the npm package. __*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. - * **npmDistTag** (string) Tags can be used to provide an alias instead of version numbers. __*Default*__: "latest" * **npmRegistry** (string) The host name of the npm registry to publish to. __*Optional*__ * **npmRegistryUrl** (string) The base URL of the npm package registry. __*Default*__: "https://registry.npmjs.org" * **npmTokenSecret** (string) GitHub secret which contains the NPM token to use when publishing packages. __*Default*__: "NPM_TOKEN" @@ -7771,8 +7762,10 @@ new typescript.TypeScriptAppProject(options: TypeScriptProjectOptions) * **artifactsDirectory** (string) A directory which will contain artifacts to be published to npm. __*Default*__: "dist" * **jsiiReleaseVersion** (string) Version requirement of `jsii-release` which is used to publish modules to npm. __*Default*__: "latest" * **majorVersion** (number) Major version to release from the default branch. __*Default*__: Major version is not enforced. + * **npmDistTag** (string) The npmDistTag to use when publishing from the default branch. __*Default*__: "latest" * **postBuildSteps** (Array<[github.workflows.JobStep](#projen-github-workflows-jobstep)>) Steps to execute after build as part of the release workflow. __*Default*__: [] * **prerelease** (string) Bump versions from the default branch as pre-releases (e.g. "beta", "alpha", "pre"). __*Default*__: normal semantic versions + * **publishTasks** (boolean) Define publishing tasks that can be executed manually as well as workflows. __*Default*__: false * **releaseBranches** (Map) Defines additional release branches. __*Default*__: no additional branches are used for release. you can use `addBranch()` to add additional branches. * **releaseEveryCommit** (boolean) Automatically release new versions every commit to one of branches in `releaseBranches`. __*Default*__: true * **releaseFailureIssue** (boolean) Create a github issue on every failed publishing task. __*Default*__: false @@ -7899,7 +7892,6 @@ new typescript.TypeScriptLibraryProject(options: TypeScriptProjectOptions) * **maxNodeVersion** (string) Minimum node.js version to require via `engines` (inclusive). __*Default*__: no max * **minNodeVersion** (string) Minimum Node.js version to require via package.json `engines` (inclusive). __*Default*__: no "engines" specified * **npmAccess** ([javascript.NpmAccess](#projen-javascript-npmaccess)) Access level of the npm package. __*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. - * **npmDistTag** (string) Tags can be used to provide an alias instead of version numbers. __*Default*__: "latest" * **npmRegistry** (string) The host name of the npm registry to publish to. __*Optional*__ * **npmRegistryUrl** (string) The base URL of the npm package registry. __*Default*__: "https://registry.npmjs.org" * **npmTokenSecret** (string) GitHub secret which contains the NPM token to use when publishing packages. __*Default*__: "NPM_TOKEN" @@ -7915,8 +7907,10 @@ new typescript.TypeScriptLibraryProject(options: TypeScriptProjectOptions) * **artifactsDirectory** (string) A directory which will contain artifacts to be published to npm. __*Default*__: "dist" * **jsiiReleaseVersion** (string) Version requirement of `jsii-release` which is used to publish modules to npm. __*Default*__: "latest" * **majorVersion** (number) Major version to release from the default branch. __*Default*__: Major version is not enforced. + * **npmDistTag** (string) The npmDistTag to use when publishing from the default branch. __*Default*__: "latest" * **postBuildSteps** (Array<[github.workflows.JobStep](#projen-github-workflows-jobstep)>) Steps to execute after build as part of the release workflow. __*Default*__: [] * **prerelease** (string) Bump versions from the default branch as pre-releases (e.g. "beta", "alpha", "pre"). __*Default*__: normal semantic versions + * **publishTasks** (boolean) Define publishing tasks that can be executed manually as well as workflows. __*Default*__: false * **releaseBranches** (Map) Defines additional release branches. __*Default*__: no additional branches are used for release. you can use `addBranch()` to add additional branches. * **releaseEveryCommit** (boolean) Automatically release new versions every commit to one of branches in `releaseBranches`. __*Default*__: true * **releaseFailureIssue** (boolean) Create a github issue on every failed publishing task. __*Default*__: false @@ -8043,7 +8037,6 @@ new typescript.TypeScriptProject(options: TypeScriptProjectOptions) * **maxNodeVersion** (string) Minimum node.js version to require via `engines` (inclusive). __*Default*__: no max * **minNodeVersion** (string) Minimum Node.js version to require via package.json `engines` (inclusive). __*Default*__: no "engines" specified * **npmAccess** ([javascript.NpmAccess](#projen-javascript-npmaccess)) Access level of the npm package. __*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. - * **npmDistTag** (string) Tags can be used to provide an alias instead of version numbers. __*Default*__: "latest" * **npmRegistry** (string) The host name of the npm registry to publish to. __*Optional*__ * **npmRegistryUrl** (string) The base URL of the npm package registry. __*Default*__: "https://registry.npmjs.org" * **npmTokenSecret** (string) GitHub secret which contains the NPM token to use when publishing packages. __*Default*__: "NPM_TOKEN" @@ -8059,8 +8052,10 @@ new typescript.TypeScriptProject(options: TypeScriptProjectOptions) * **artifactsDirectory** (string) A directory which will contain artifacts to be published to npm. __*Default*__: "dist" * **jsiiReleaseVersion** (string) Version requirement of `jsii-release` which is used to publish modules to npm. __*Default*__: "latest" * **majorVersion** (number) Major version to release from the default branch. __*Default*__: Major version is not enforced. + * **npmDistTag** (string) The npmDistTag to use when publishing from the default branch. __*Default*__: "latest" * **postBuildSteps** (Array<[github.workflows.JobStep](#projen-github-workflows-jobstep)>) Steps to execute after build as part of the release workflow. __*Default*__: [] * **prerelease** (string) Bump versions from the default branch as pre-releases (e.g. "beta", "alpha", "pre"). __*Default*__: normal semantic versions + * **publishTasks** (boolean) Define publishing tasks that can be executed manually as well as workflows. __*Default*__: false * **releaseBranches** (Map) Defines additional release branches. __*Default*__: no additional branches are used for release. you can use `addBranch()` to add additional branches. * **releaseEveryCommit** (boolean) Automatically release new versions every commit to one of branches in `releaseBranches`. __*Default*__: true * **releaseFailureIssue** (boolean) Create a github issue on every failed publishing task. __*Default*__: false @@ -8432,7 +8427,6 @@ new web.NextJsProject(options: NextJsProjectOptions) * **maxNodeVersion** (string) Minimum node.js version to require via `engines` (inclusive). __*Default*__: no max * **minNodeVersion** (string) Minimum Node.js version to require via package.json `engines` (inclusive). __*Default*__: no "engines" specified * **npmAccess** ([javascript.NpmAccess](#projen-javascript-npmaccess)) Access level of the npm package. __*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. - * **npmDistTag** (string) Tags can be used to provide an alias instead of version numbers. __*Default*__: "latest" * **npmRegistry** (string) The host name of the npm registry to publish to. __*Optional*__ * **npmRegistryUrl** (string) The base URL of the npm package registry. __*Default*__: "https://registry.npmjs.org" * **npmTokenSecret** (string) GitHub secret which contains the NPM token to use when publishing packages. __*Default*__: "NPM_TOKEN" @@ -8448,8 +8442,10 @@ new web.NextJsProject(options: NextJsProjectOptions) * **artifactsDirectory** (string) A directory which will contain artifacts to be published to npm. __*Default*__: "dist" * **jsiiReleaseVersion** (string) Version requirement of `jsii-release` which is used to publish modules to npm. __*Default*__: "latest" * **majorVersion** (number) Major version to release from the default branch. __*Default*__: Major version is not enforced. + * **npmDistTag** (string) The npmDistTag to use when publishing from the default branch. __*Default*__: "latest" * **postBuildSteps** (Array<[github.workflows.JobStep](#projen-github-workflows-jobstep)>) Steps to execute after build as part of the release workflow. __*Default*__: [] * **prerelease** (string) Bump versions from the default branch as pre-releases (e.g. "beta", "alpha", "pre"). __*Default*__: normal semantic versions + * **publishTasks** (boolean) Define publishing tasks that can be executed manually as well as workflows. __*Default*__: false * **releaseBranches** (Map) Defines additional release branches. __*Default*__: no additional branches are used for release. you can use `addBranch()` to add additional branches. * **releaseEveryCommit** (boolean) Automatically release new versions every commit to one of branches in `releaseBranches`. __*Default*__: true * **releaseFailureIssue** (boolean) Create a github issue on every failed publishing task. __*Default*__: false @@ -8573,7 +8569,6 @@ new web.NextJsTypeScriptProject(options: NextJsTypeScriptProjectOptions) * **maxNodeVersion** (string) Minimum node.js version to require via `engines` (inclusive). __*Default*__: no max * **minNodeVersion** (string) Minimum Node.js version to require via package.json `engines` (inclusive). __*Default*__: no "engines" specified * **npmAccess** ([javascript.NpmAccess](#projen-javascript-npmaccess)) Access level of the npm package. __*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. - * **npmDistTag** (string) Tags can be used to provide an alias instead of version numbers. __*Default*__: "latest" * **npmRegistry** (string) The host name of the npm registry to publish to. __*Optional*__ * **npmRegistryUrl** (string) The base URL of the npm package registry. __*Default*__: "https://registry.npmjs.org" * **npmTokenSecret** (string) GitHub secret which contains the NPM token to use when publishing packages. __*Default*__: "NPM_TOKEN" @@ -8589,8 +8584,10 @@ new web.NextJsTypeScriptProject(options: NextJsTypeScriptProjectOptions) * **artifactsDirectory** (string) A directory which will contain artifacts to be published to npm. __*Default*__: "dist" * **jsiiReleaseVersion** (string) Version requirement of `jsii-release` which is used to publish modules to npm. __*Default*__: "latest" * **majorVersion** (number) Major version to release from the default branch. __*Default*__: Major version is not enforced. + * **npmDistTag** (string) The npmDistTag to use when publishing from the default branch. __*Default*__: "latest" * **postBuildSteps** (Array<[github.workflows.JobStep](#projen-github-workflows-jobstep)>) Steps to execute after build as part of the release workflow. __*Default*__: [] * **prerelease** (string) Bump versions from the default branch as pre-releases (e.g. "beta", "alpha", "pre"). __*Default*__: normal semantic versions + * **publishTasks** (boolean) Define publishing tasks that can be executed manually as well as workflows. __*Default*__: false * **releaseBranches** (Map) Defines additional release branches. __*Default*__: no additional branches are used for release. you can use `addBranch()` to add additional branches. * **releaseEveryCommit** (boolean) Automatically release new versions every commit to one of branches in `releaseBranches`. __*Default*__: true * **releaseFailureIssue** (boolean) Create a github issue on every failed publishing task. __*Default*__: false @@ -8787,7 +8784,6 @@ new web.ReactProject(options: ReactProjectOptions) * **maxNodeVersion** (string) Minimum node.js version to require via `engines` (inclusive). __*Default*__: no max * **minNodeVersion** (string) Minimum Node.js version to require via package.json `engines` (inclusive). __*Default*__: no "engines" specified * **npmAccess** ([javascript.NpmAccess](#projen-javascript-npmaccess)) Access level of the npm package. __*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. - * **npmDistTag** (string) Tags can be used to provide an alias instead of version numbers. __*Default*__: "latest" * **npmRegistry** (string) The host name of the npm registry to publish to. __*Optional*__ * **npmRegistryUrl** (string) The base URL of the npm package registry. __*Default*__: "https://registry.npmjs.org" * **npmTokenSecret** (string) GitHub secret which contains the NPM token to use when publishing packages. __*Default*__: "NPM_TOKEN" @@ -8803,8 +8799,10 @@ new web.ReactProject(options: ReactProjectOptions) * **artifactsDirectory** (string) A directory which will contain artifacts to be published to npm. __*Default*__: "dist" * **jsiiReleaseVersion** (string) Version requirement of `jsii-release` which is used to publish modules to npm. __*Default*__: "latest" * **majorVersion** (number) Major version to release from the default branch. __*Default*__: Major version is not enforced. + * **npmDistTag** (string) The npmDistTag to use when publishing from the default branch. __*Default*__: "latest" * **postBuildSteps** (Array<[github.workflows.JobStep](#projen-github-workflows-jobstep)>) Steps to execute after build as part of the release workflow. __*Default*__: [] * **prerelease** (string) Bump versions from the default branch as pre-releases (e.g. "beta", "alpha", "pre"). __*Default*__: normal semantic versions + * **publishTasks** (boolean) Define publishing tasks that can be executed manually as well as workflows. __*Default*__: false * **releaseBranches** (Map) Defines additional release branches. __*Default*__: no additional branches are used for release. you can use `addBranch()` to add additional branches. * **releaseEveryCommit** (boolean) Automatically release new versions every commit to one of branches in `releaseBranches`. __*Default*__: true * **releaseFailureIssue** (boolean) Create a github issue on every failed publishing task. __*Default*__: false @@ -8969,7 +8967,6 @@ new web.ReactTypeScriptProject(options: ReactTypeScriptProjectOptions) * **maxNodeVersion** (string) Minimum node.js version to require via `engines` (inclusive). __*Default*__: no max * **minNodeVersion** (string) Minimum Node.js version to require via package.json `engines` (inclusive). __*Default*__: no "engines" specified * **npmAccess** ([javascript.NpmAccess](#projen-javascript-npmaccess)) Access level of the npm package. __*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. - * **npmDistTag** (string) Tags can be used to provide an alias instead of version numbers. __*Default*__: "latest" * **npmRegistry** (string) The host name of the npm registry to publish to. __*Optional*__ * **npmRegistryUrl** (string) The base URL of the npm package registry. __*Default*__: "https://registry.npmjs.org" * **npmTokenSecret** (string) GitHub secret which contains the NPM token to use when publishing packages. __*Default*__: "NPM_TOKEN" @@ -8985,8 +8982,10 @@ new web.ReactTypeScriptProject(options: ReactTypeScriptProjectOptions) * **artifactsDirectory** (string) A directory which will contain artifacts to be published to npm. __*Default*__: "dist" * **jsiiReleaseVersion** (string) Version requirement of `jsii-release` which is used to publish modules to npm. __*Default*__: "latest" * **majorVersion** (number) Major version to release from the default branch. __*Default*__: Major version is not enforced. + * **npmDistTag** (string) The npmDistTag to use when publishing from the default branch. __*Default*__: "latest" * **postBuildSteps** (Array<[github.workflows.JobStep](#projen-github-workflows-jobstep)>) Steps to execute after build as part of the release workflow. __*Default*__: [] * **prerelease** (string) Bump versions from the default branch as pre-releases (e.g. "beta", "alpha", "pre"). __*Default*__: normal semantic versions + * **publishTasks** (boolean) Define publishing tasks that can be executed manually as well as workflows. __*Default*__: false * **releaseBranches** (Map) Defines additional release branches. __*Default*__: no additional branches are used for release. you can use `addBranch()` to add additional branches. * **releaseEveryCommit** (boolean) Automatically release new versions every commit to one of branches in `releaseBranches`. __*Default*__: true * **releaseFailureIssue** (boolean) Create a github issue on every failed publishing task. __*Default*__: false @@ -10093,7 +10092,7 @@ Name | Type | Description **minNodeVersion**?🔹 | string | Minimum Node.js version to require via package.json `engines` (inclusive).
__*Default*__: no "engines" specified **mutableBuild**?🔹 | boolean | Automatically update files modified during builds to pull-request branches.
__*Default*__: true **npmAccess**?🔹 | [javascript.NpmAccess](#projen-javascript-npmaccess) | Access level of the npm package.
__*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. -**npmDistTag**?🔹 | string | Tags can be used to provide an alias instead of version numbers.
__*Default*__: "latest" +**npmDistTag**?🔹 | string | The npmDistTag to use when publishing from the default branch.
__*Default*__: "latest" **npmRegistry**?⚠️ | string | The host name of the npm registry to publish to.
__*Optional*__ **npmRegistryUrl**?🔹 | string | The base URL of the npm package registry.
__*Default*__: "https://registry.npmjs.org" **npmTokenSecret**?🔹 | string | GitHub secret which contains the NPM token to use when publishing packages.
__*Default*__: "NPM_TOKEN" @@ -10121,6 +10120,7 @@ Name | Type | Description **projenrcJsonOptions**?🔹 | [ProjenrcOptions](#projen-projenrcoptions) | Options for .projenrc.json.
__*Default*__: default options **projenrcTs**?🔹 | boolean | Use TypeScript for your projenrc file (`.projenrc.ts`).
__*Default*__: false **projenrcTsOptions**?🔹 | [typescript.ProjenrcOptions](#projen-typescript-projenrcoptions) | Options for .projenrc.ts.
__*Optional*__ +**publishTasks**?🔹 | boolean | Define publishing tasks that can be executed manually as well as workflows.
__*Default*__: false **publishToGo**?🔹 | [cdk.JsiiGoTarget](#projen-cdk-jsiigotarget) | Publish Go bindings to a git repository.
__*Default*__: no publishing **publishToMaven**?🔹 | [cdk.JsiiJavaTarget](#projen-cdk-jsiijavatarget) | Publish to maven.
__*Default*__: no publishing **publishToNuget**?🔹 | [cdk.JsiiDotNetTarget](#projen-cdk-jsiidotnettarget) | Publish to NuGet.
__*Default*__: no publishing @@ -10301,7 +10301,7 @@ Name | Type | Description **minNodeVersion**?🔹 | string | Minimum Node.js version to require via package.json `engines` (inclusive).
__*Default*__: no "engines" specified **mutableBuild**?🔹 | boolean | Automatically update files modified during builds to pull-request branches.
__*Default*__: true **npmAccess**?🔹 | [javascript.NpmAccess](#projen-javascript-npmaccess) | Access level of the npm package.
__*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. -**npmDistTag**?🔹 | string | Tags can be used to provide an alias instead of version numbers.
__*Default*__: "latest" +**npmDistTag**?🔹 | string | The npmDistTag to use when publishing from the default branch.
__*Default*__: "latest" **npmRegistry**?⚠️ | string | The host name of the npm registry to publish to.
__*Optional*__ **npmRegistryUrl**?🔹 | string | The base URL of the npm package registry.
__*Default*__: "https://registry.npmjs.org" **npmTokenSecret**?🔹 | string | GitHub secret which contains the NPM token to use when publishing packages.
__*Default*__: "NPM_TOKEN" @@ -10329,6 +10329,7 @@ Name | Type | Description **projenrcJsonOptions**?🔹 | [ProjenrcOptions](#projen-projenrcoptions) | Options for .projenrc.json.
__*Default*__: default options **projenrcTs**?🔹 | boolean | Use TypeScript for your projenrc file (`.projenrc.ts`).
__*Default*__: false **projenrcTsOptions**?🔹 | [typescript.ProjenrcOptions](#projen-typescript-projenrcoptions) | Options for .projenrc.ts.
__*Optional*__ +**publishTasks**?🔹 | boolean | Define publishing tasks that can be executed manually as well as workflows.
__*Default*__: false **pullRequestTemplate**?🔹 | boolean | Include a GitHub pull request template.
__*Default*__: true **pullRequestTemplateContents**?🔹 | Array | The contents of the pull request template.
__*Default*__: default content **readme**?🔹 | [SampleReadmeProps](#projen-samplereadmeprops) | The README setup.
__*Default*__: { filename: 'README.md', contents: '# replace this' } @@ -10493,7 +10494,7 @@ Name | Type | Description **minNodeVersion**?⚠️ | string | Minimum Node.js version to require via package.json `engines` (inclusive).
__*Default*__: no "engines" specified **mutableBuild**?⚠️ | boolean | Automatically update files modified during builds to pull-request branches.
__*Default*__: true **npmAccess**?⚠️ | [javascript.NpmAccess](#projen-javascript-npmaccess) | Access level of the npm package.
__*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. -**npmDistTag**?⚠️ | string | Tags can be used to provide an alias instead of version numbers.
__*Default*__: "latest" +**npmDistTag**?⚠️ | string | The npmDistTag to use when publishing from the default branch.
__*Default*__: "latest" **npmRegistry**?⚠️ | string | The host name of the npm registry to publish to.
__*Optional*__ **npmRegistryUrl**?⚠️ | string | The base URL of the npm package registry.
__*Default*__: "https://registry.npmjs.org" **npmTokenSecret**?⚠️ | string | GitHub secret which contains the NPM token to use when publishing packages.
__*Default*__: "NPM_TOKEN" @@ -10521,6 +10522,7 @@ Name | Type | Description **projenrcJsonOptions**?⚠️ | [ProjenrcOptions](#projen-projenrcoptions) | Options for .projenrc.json.
__*Default*__: default options **projenrcTs**?⚠️ | boolean | Use TypeScript for your projenrc file (`.projenrc.ts`).
__*Default*__: false **projenrcTsOptions**?⚠️ | [typescript.ProjenrcOptions](#projen-typescript-projenrcoptions) | Options for .projenrc.ts.
__*Optional*__ +**publishTasks**?⚠️ | boolean | Define publishing tasks that can be executed manually as well as workflows.
__*Default*__: false **publishToGo**?⚠️ | [cdk.JsiiGoTarget](#projen-cdk-jsiigotarget) | Publish Go bindings to a git repository.
__*Default*__: no publishing **publishToMaven**?⚠️ | [cdk.JsiiJavaTarget](#projen-cdk-jsiijavatarget) | Publish to maven.
__*Default*__: no publishing **publishToNuget**?⚠️ | [cdk.JsiiDotNetTarget](#projen-cdk-jsiidotnettarget) | Publish to NuGet.
__*Default*__: no publishing @@ -10717,7 +10719,7 @@ Name | Type | Description **minNodeVersion**?🔹 | string | Minimum Node.js version to require via package.json `engines` (inclusive).
__*Default*__: no "engines" specified **mutableBuild**?🔹 | boolean | Automatically update files modified during builds to pull-request branches.
__*Default*__: true **npmAccess**?🔹 | [javascript.NpmAccess](#projen-javascript-npmaccess) | Access level of the npm package.
__*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. -**npmDistTag**?🔹 | string | Tags can be used to provide an alias instead of version numbers.
__*Default*__: "latest" +**npmDistTag**?🔹 | string | The npmDistTag to use when publishing from the default branch.
__*Default*__: "latest" **npmRegistry**?⚠️ | string | The host name of the npm registry to publish to.
__*Optional*__ **npmRegistryUrl**?🔹 | string | The base URL of the npm package registry.
__*Default*__: "https://registry.npmjs.org" **npmTokenSecret**?🔹 | string | GitHub secret which contains the NPM token to use when publishing packages.
__*Default*__: "NPM_TOKEN" @@ -10745,6 +10747,7 @@ Name | Type | Description **projenrcJsonOptions**?🔹 | [ProjenrcOptions](#projen-projenrcoptions) | Options for .projenrc.json.
__*Default*__: default options **projenrcTs**?🔹 | boolean | Use TypeScript for your projenrc file (`.projenrc.ts`).
__*Default*__: false **projenrcTsOptions**?🔹 | [typescript.ProjenrcOptions](#projen-typescript-projenrcoptions) | Options for .projenrc.ts.
__*Optional*__ +**publishTasks**?🔹 | boolean | Define publishing tasks that can be executed manually as well as workflows.
__*Default*__: false **publishToGo**?🔹 | [cdk.JsiiGoTarget](#projen-cdk-jsiigotarget) | Publish Go bindings to a git repository.
__*Default*__: no publishing **publishToMaven**?🔹 | [cdk.JsiiJavaTarget](#projen-cdk-jsiijavatarget) | Publish to maven.
__*Default*__: no publishing **publishToNuget**?🔹 | [cdk.JsiiDotNetTarget](#projen-cdk-jsiidotnettarget) | Publish to NuGet.
__*Default*__: no publishing @@ -10921,7 +10924,7 @@ Name | Type | Description **minNodeVersion**?🔹 | string | Minimum Node.js version to require via package.json `engines` (inclusive).
__*Default*__: no "engines" specified **mutableBuild**?🔹 | boolean | Automatically update files modified during builds to pull-request branches.
__*Default*__: true **npmAccess**?🔹 | [javascript.NpmAccess](#projen-javascript-npmaccess) | Access level of the npm package.
__*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. -**npmDistTag**?🔹 | string | Tags can be used to provide an alias instead of version numbers.
__*Default*__: "latest" +**npmDistTag**?🔹 | string | The npmDistTag to use when publishing from the default branch.
__*Default*__: "latest" **npmRegistry**?⚠️ | string | The host name of the npm registry to publish to.
__*Optional*__ **npmRegistryUrl**?🔹 | string | The base URL of the npm package registry.
__*Default*__: "https://registry.npmjs.org" **npmTokenSecret**?🔹 | string | GitHub secret which contains the NPM token to use when publishing packages.
__*Default*__: "NPM_TOKEN" @@ -10949,6 +10952,7 @@ Name | Type | Description **projenrcJsonOptions**?🔹 | [ProjenrcOptions](#projen-projenrcoptions) | Options for .projenrc.json.
__*Default*__: default options **projenrcTs**?🔹 | boolean | Use TypeScript for your projenrc file (`.projenrc.ts`).
__*Default*__: false **projenrcTsOptions**?🔹 | [typescript.ProjenrcOptions](#projen-typescript-projenrcoptions) | Options for .projenrc.ts.
__*Optional*__ +**publishTasks**?🔹 | boolean | Define publishing tasks that can be executed manually as well as workflows.
__*Default*__: false **publishToGo**?🔹 | [cdk.JsiiGoTarget](#projen-cdk-jsiigotarget) | Publish Go bindings to a git repository.
__*Default*__: no publishing **publishToMaven**?🔹 | [cdk.JsiiJavaTarget](#projen-cdk-jsiijavatarget) | Publish to maven.
__*Default*__: no publishing **publishToNuget**?🔹 | [cdk.JsiiDotNetTarget](#projen-cdk-jsiidotnettarget) | Publish to NuGet.
__*Default*__: no publishing @@ -11086,7 +11090,7 @@ Name | Type | Description **minNodeVersion**?🔹 | string | Minimum Node.js version to require via package.json `engines` (inclusive).
__*Default*__: no "engines" specified **mutableBuild**?🔹 | boolean | Automatically update files modified during builds to pull-request branches.
__*Default*__: true **npmAccess**?🔹 | [javascript.NpmAccess](#projen-javascript-npmaccess) | Access level of the npm package.
__*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. -**npmDistTag**?🔹 | string | Tags can be used to provide an alias instead of version numbers.
__*Default*__: "latest" +**npmDistTag**?🔹 | string | The npmDistTag to use when publishing from the default branch.
__*Default*__: "latest" **npmRegistry**?⚠️ | string | The host name of the npm registry to publish to.
__*Optional*__ **npmRegistryUrl**?🔹 | string | The base URL of the npm package registry.
__*Default*__: "https://registry.npmjs.org" **npmTokenSecret**?🔹 | string | GitHub secret which contains the NPM token to use when publishing packages.
__*Default*__: "NPM_TOKEN" @@ -11114,6 +11118,7 @@ Name | Type | Description **projenrcJsonOptions**?🔹 | [ProjenrcOptions](#projen-projenrcoptions) | Options for .projenrc.json.
__*Default*__: default options **projenrcTs**?🔹 | boolean | Use TypeScript for your projenrc file (`.projenrc.ts`).
__*Default*__: false **projenrcTsOptions**?🔹 | [typescript.ProjenrcOptions](#projen-typescript-projenrcoptions) | Options for .projenrc.ts.
__*Optional*__ +**publishTasks**?🔹 | boolean | Define publishing tasks that can be executed manually as well as workflows.
__*Default*__: false **pullRequestTemplate**?🔹 | boolean | Include a GitHub pull request template.
__*Default*__: true **pullRequestTemplateContents**?🔹 | Array | The contents of the pull request template.
__*Default*__: default content **readme**?🔹 | [SampleReadmeProps](#projen-samplereadmeprops) | The README setup.
__*Default*__: { filename: 'README.md', contents: '# replace this' } @@ -11233,7 +11238,7 @@ Name | Type | Description **minNodeVersion**?🔹 | string | Minimum Node.js version to require via package.json `engines` (inclusive).
__*Default*__: no "engines" specified **mutableBuild**?🔹 | boolean | Automatically update files modified during builds to pull-request branches.
__*Default*__: true **npmAccess**?🔹 | [javascript.NpmAccess](#projen-javascript-npmaccess) | Access level of the npm package.
__*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. -**npmDistTag**?🔹 | string | Tags can be used to provide an alias instead of version numbers.
__*Default*__: "latest" +**npmDistTag**?🔹 | string | The npmDistTag to use when publishing from the default branch.
__*Default*__: "latest" **npmRegistry**?⚠️ | string | The host name of the npm registry to publish to.
__*Optional*__ **npmRegistryUrl**?🔹 | string | The base URL of the npm package registry.
__*Default*__: "https://registry.npmjs.org" **npmTokenSecret**?🔹 | string | GitHub secret which contains the NPM token to use when publishing packages.
__*Default*__: "NPM_TOKEN" @@ -11261,6 +11266,7 @@ Name | Type | Description **projenrcJsonOptions**?🔹 | [ProjenrcOptions](#projen-projenrcoptions) | Options for .projenrc.json.
__*Default*__: default options **projenrcTs**?🔹 | boolean | Use TypeScript for your projenrc file (`.projenrc.ts`).
__*Default*__: false **projenrcTsOptions**?🔹 | [typescript.ProjenrcOptions](#projen-typescript-projenrcoptions) | Options for .projenrc.ts.
__*Optional*__ +**publishTasks**?🔹 | boolean | Define publishing tasks that can be executed manually as well as workflows.
__*Default*__: false **publishToGo**?🔹 | [cdk.JsiiGoTarget](#projen-cdk-jsiigotarget) | Publish Go bindings to a git repository.
__*Default*__: no publishing **publishToMaven**?🔹 | [cdk.JsiiJavaTarget](#projen-cdk-jsiijavatarget) | Publish to maven.
__*Default*__: no publishing **publishToNuget**?🔹 | [cdk.JsiiDotNetTarget](#projen-cdk-jsiidotnettarget) | Publish to NuGet.
__*Default*__: no publishing @@ -11382,7 +11388,7 @@ Name | Type | Description **minNodeVersion**?🔹 | string | Minimum Node.js version to require via package.json `engines` (inclusive).
__*Default*__: no "engines" specified **mutableBuild**?🔹 | boolean | Automatically update files modified during builds to pull-request branches.
__*Default*__: true **npmAccess**?🔹 | [javascript.NpmAccess](#projen-javascript-npmaccess) | Access level of the npm package.
__*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. -**npmDistTag**?🔹 | string | Tags can be used to provide an alias instead of version numbers.
__*Default*__: "latest" +**npmDistTag**?🔹 | string | The npmDistTag to use when publishing from the default branch.
__*Default*__: "latest" **npmRegistry**?⚠️ | string | The host name of the npm registry to publish to.
__*Optional*__ **npmRegistryUrl**?🔹 | string | The base URL of the npm package registry.
__*Default*__: "https://registry.npmjs.org" **npmTokenSecret**?🔹 | string | GitHub secret which contains the NPM token to use when publishing packages.
__*Default*__: "NPM_TOKEN" @@ -11410,6 +11416,7 @@ Name | Type | Description **projenrcJsonOptions**?🔹 | [ProjenrcOptions](#projen-projenrcoptions) | Options for .projenrc.json.
__*Default*__: default options **projenrcTs**?🔹 | boolean | Use TypeScript for your projenrc file (`.projenrc.ts`).
__*Default*__: false **projenrcTsOptions**?🔹 | [typescript.ProjenrcOptions](#projen-typescript-projenrcoptions) | Options for .projenrc.ts.
__*Optional*__ +**publishTasks**?🔹 | boolean | Define publishing tasks that can be executed manually as well as workflows.
__*Default*__: false **publishToGo**?🔹 | [cdk.JsiiGoTarget](#projen-cdk-jsiigotarget) | Publish Go bindings to a git repository.
__*Default*__: no publishing **publishToMaven**?🔹 | [cdk.JsiiJavaTarget](#projen-cdk-jsiijavatarget) | Publish to maven.
__*Default*__: no publishing **publishToNuget**?🔹 | [cdk.JsiiDotNetTarget](#projen-cdk-jsiidotnettarget) | Publish to NuGet.
__*Default*__: no publishing @@ -11619,7 +11626,6 @@ Name | Type | Description ## interface IJobProvider 🔹 -__Implemented by__: [release.Publisher](#projen-release-publisher) ### Methods @@ -12275,7 +12281,6 @@ Name | Type | Description **maxNodeVersion**?🔹 | string | Minimum node.js version to require via `engines` (inclusive).
__*Default*__: no max **minNodeVersion**?🔹 | string | Minimum Node.js version to require via package.json `engines` (inclusive).
__*Default*__: no "engines" specified **npmAccess**?🔹 | [javascript.NpmAccess](#projen-javascript-npmaccess) | Access level of the npm package.
__*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. -**npmDistTag**?🔹 | string | Tags can be used to provide an alias instead of version numbers.
__*Default*__: "latest" **npmRegistry**?⚠️ | string | The host name of the npm registry to publish to.
__*Optional*__ **npmRegistryUrl**?🔹 | string | The base URL of the npm package registry.
__*Default*__: "https://registry.npmjs.org" **npmTokenSecret**?🔹 | string | GitHub secret which contains the NPM token to use when publishing packages.
__*Default*__: "NPM_TOKEN" @@ -12351,7 +12356,7 @@ Name | Type | Description **minNodeVersion**?🔹 | string | Minimum Node.js version to require via package.json `engines` (inclusive).
__*Default*__: no "engines" specified **mutableBuild**?🔹 | boolean | Automatically update files modified during builds to pull-request branches.
__*Default*__: true **npmAccess**?🔹 | [javascript.NpmAccess](#projen-javascript-npmaccess) | Access level of the npm package.
__*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. -**npmDistTag**?🔹 | string | Tags can be used to provide an alias instead of version numbers.
__*Default*__: "latest" +**npmDistTag**?🔹 | string | The npmDistTag to use when publishing from the default branch.
__*Default*__: "latest" **npmRegistry**?⚠️ | string | The host name of the npm registry to publish to.
__*Optional*__ **npmRegistryUrl**?🔹 | string | The base URL of the npm package registry.
__*Default*__: "https://registry.npmjs.org" **npmTokenSecret**?🔹 | string | GitHub secret which contains the NPM token to use when publishing packages.
__*Default*__: "NPM_TOKEN" @@ -12376,6 +12381,7 @@ Name | Type | Description **projenrcJsOptions**?🔹 | [javascript.ProjenrcOptions](#projen-javascript-projenrcoptions) | Options for .projenrc.js.
__*Default*__: default options **projenrcJson**?🔹 | boolean | Generate (once) .projenrc.json (in JSON). Set to `false` in order to disable .projenrc.json generation.
__*Default*__: false **projenrcJsonOptions**?🔹 | [ProjenrcOptions](#projen-projenrcoptions) | Options for .projenrc.json.
__*Default*__: default options +**publishTasks**?🔹 | boolean | Define publishing tasks that can be executed manually as well as workflows.
__*Default*__: false **pullRequestTemplate**?🔹 | boolean | Include a GitHub pull request template.
__*Default*__: true **pullRequestTemplateContents**?🔹 | Array | The contents of the pull request template.
__*Default*__: default content **readme**?🔹 | [SampleReadmeProps](#projen-samplereadmeprops) | The README setup.
__*Default*__: { filename: 'README.md', contents: '# replace this' } @@ -12912,6 +12918,7 @@ Options for a release branch. Name | Type | Description -----|------|------------- **majorVersion**🔹 | number | The major versions released from this branch. +**npmDistTag**?🔹 | string | The npm distribution tag to use for this branch.
__*Default*__: "latest" **prerelease**?🔹 | string | Bump the version as a pre-release tag.
__*Default*__: normal releases **tagPrefix**?🔹 | string | Automatically add the given prefix to release tags. Useful if you are releasing on multiple branches with overlapping version numbers.
__*Default*__: no prefix **workflowName**?🔹 | string | The name of the release workflow.
__*Default*__: "release-BRANCH" @@ -13093,7 +13100,7 @@ Options for npm release. Name | Type | Description -----|------|------------- **codeArtifactOptions**?🔹 | [release.CodeArtifactOptions](#projen-release-codeartifactoptions) | Options for publishing npm package to AWS CodeArtifact.
__*Default*__: undefined -**distTag**?🔹 | string | Tags can be used to provide an alias instead of version numbers.
__*Default*__: "latest" +**distTag**?⚠️ | string | Tags can be used to provide an alias instead of version numbers.
__*Default*__: "latest" **npmTokenSecret**?🔹 | string | GitHub secret which contains the NPM token to use when publishing packages.
__*Default*__: "NPM_TOKEN" or "GITHUB_TOKEN" if `registry` is set to `npm.pkg.github.com`. **registry**?🔹 | string | The domain name of the npm package registry.
__*Default*__: "registry.npmjs.org" @@ -13127,6 +13134,7 @@ Name | Type | Description **failureIssue**?🔹 | boolean | Create an issue when a publish task fails.
__*Default*__: false **failureIssueLabel**?🔹 | string | The label to apply to the issue marking failed publish tasks.
__*Default*__: "failed-release" **jsiiReleaseVersion**?🔹 | string | Version requirement for `jsii-release`.
__*Default*__: "latest" +**publishTasks**?🔹 | boolean | Define publishing tasks that can be executed manually as well as workflows.
__*Default*__: false **workflowRunsOn**?🔹 | Array | Github Runner selection labels.
__*Default*__: ["ubuntu-latest"] @@ -13163,8 +13171,10 @@ Name | Type | Description **githubRelease**?🔹 | boolean | Create a GitHub release for each release.
__*Default*__: true **jsiiReleaseVersion**?🔹 | string | Version requirement of `jsii-release` which is used to publish modules to npm.
__*Default*__: "latest" **majorVersion**?🔹 | number | Major version to release from the default branch.
__*Default*__: Major version is not enforced. +**npmDistTag**?🔹 | string | The npmDistTag to use when publishing from the default branch.
__*Default*__: "latest" **postBuildSteps**?🔹 | Array<[github.workflows.JobStep](#projen-github-workflows-jobstep)> | Steps to execute after build as part of the release workflow.
__*Default*__: [] **prerelease**?🔹 | string | Bump versions from the default branch as pre-releases (e.g. "beta", "alpha", "pre").
__*Default*__: normal semantic versions +**publishTasks**?🔹 | boolean | Define publishing tasks that can be executed manually as well as workflows.
__*Default*__: false **releaseBranches**?🔹 | Map | Defines additional release branches.
__*Default*__: no additional branches are used for release. you can use `addBranch()` to add additional branches. **releaseEveryCommit**?⚠️ | boolean | Automatically release new versions every commit to one of branches in `releaseBranches`.
__*Default*__: true **releaseFailureIssue**?🔹 | boolean | Create a github issue on every failed publishing task.
__*Default*__: false @@ -13193,8 +13203,10 @@ Name | Type | Description **artifactsDirectory**?🔹 | string | A directory which will contain artifacts to be published to npm.
__*Default*__: "dist" **jsiiReleaseVersion**?🔹 | string | Version requirement of `jsii-release` which is used to publish modules to npm.
__*Default*__: "latest" **majorVersion**?🔹 | number | Major version to release from the default branch.
__*Default*__: Major version is not enforced. +**npmDistTag**?🔹 | string | The npmDistTag to use when publishing from the default branch.
__*Default*__: "latest" **postBuildSteps**?🔹 | Array<[github.workflows.JobStep](#projen-github-workflows-jobstep)> | Steps to execute after build as part of the release workflow.
__*Default*__: [] **prerelease**?🔹 | string | Bump versions from the default branch as pre-releases (e.g. "beta", "alpha", "pre").
__*Default*__: normal semantic versions +**publishTasks**?🔹 | boolean | Define publishing tasks that can be executed manually as well as workflows.
__*Default*__: false **releaseBranches**?🔹 | Map | Defines additional release branches.
__*Default*__: no additional branches are used for release. you can use `addBranch()` to add additional branches. **releaseEveryCommit**?⚠️ | boolean | Automatically release new versions every commit to one of branches in `releaseBranches`.
__*Default*__: true **releaseFailureIssue**?🔹 | boolean | Create a github issue on every failed publishing task.
__*Default*__: false @@ -13305,7 +13317,7 @@ Name | Type | Description **minNodeVersion**?⚠️ | string | Minimum Node.js version to require via package.json `engines` (inclusive).
__*Default*__: no "engines" specified **mutableBuild**?⚠️ | boolean | Automatically update files modified during builds to pull-request branches.
__*Default*__: true **npmAccess**?⚠️ | [javascript.NpmAccess](#projen-javascript-npmaccess) | Access level of the npm package.
__*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. -**npmDistTag**?⚠️ | string | Tags can be used to provide an alias instead of version numbers.
__*Default*__: "latest" +**npmDistTag**?⚠️ | string | The npmDistTag to use when publishing from the default branch.
__*Default*__: "latest" **npmRegistry**?⚠️ | string | The host name of the npm registry to publish to.
__*Optional*__ **npmRegistryUrl**?⚠️ | string | The base URL of the npm package registry.
__*Default*__: "https://registry.npmjs.org" **npmTokenSecret**?⚠️ | string | GitHub secret which contains the NPM token to use when publishing packages.
__*Default*__: "NPM_TOKEN" @@ -13333,6 +13345,7 @@ Name | Type | Description **projenrcJsonOptions**?⚠️ | [ProjenrcOptions](#projen-projenrcoptions) | Options for .projenrc.json.
__*Default*__: default options **projenrcTs**?⚠️ | boolean | Use TypeScript for your projenrc file (`.projenrc.ts`).
__*Default*__: false **projenrcTsOptions**?⚠️ | [typescript.ProjenrcOptions](#projen-typescript-projenrcoptions) | Options for .projenrc.ts.
__*Optional*__ +**publishTasks**?⚠️ | boolean | Define publishing tasks that can be executed manually as well as workflows.
__*Default*__: false **pullRequestTemplate**?⚠️ | boolean | Include a GitHub pull request template.
__*Default*__: true **pullRequestTemplateContents**?⚠️ | Array | The contents of the pull request template.
__*Default*__: default content **readme**?⚠️ | [SampleReadmeProps](#projen-samplereadmeprops) | The README setup.
__*Default*__: { filename: 'README.md', contents: '# replace this' } @@ -13439,7 +13452,7 @@ Name | Type | Description **minNodeVersion**?🔹 | string | Minimum Node.js version to require via package.json `engines` (inclusive).
__*Default*__: no "engines" specified **mutableBuild**?🔹 | boolean | Automatically update files modified during builds to pull-request branches.
__*Default*__: true **npmAccess**?🔹 | [javascript.NpmAccess](#projen-javascript-npmaccess) | Access level of the npm package.
__*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. -**npmDistTag**?🔹 | string | Tags can be used to provide an alias instead of version numbers.
__*Default*__: "latest" +**npmDistTag**?🔹 | string | The npmDistTag to use when publishing from the default branch.
__*Default*__: "latest" **npmRegistry**?⚠️ | string | The host name of the npm registry to publish to.
__*Optional*__ **npmRegistryUrl**?🔹 | string | The base URL of the npm package registry.
__*Default*__: "https://registry.npmjs.org" **npmTokenSecret**?🔹 | string | GitHub secret which contains the NPM token to use when publishing packages.
__*Default*__: "NPM_TOKEN" @@ -13467,6 +13480,7 @@ Name | Type | Description **projenrcJsonOptions**?🔹 | [ProjenrcOptions](#projen-projenrcoptions) | Options for .projenrc.json.
__*Default*__: default options **projenrcTs**?🔹 | boolean | Use TypeScript for your projenrc file (`.projenrc.ts`).
__*Default*__: false **projenrcTsOptions**?🔹 | [typescript.ProjenrcOptions](#projen-typescript-projenrcoptions) | Options for .projenrc.ts.
__*Optional*__ +**publishTasks**?🔹 | boolean | Define publishing tasks that can be executed manually as well as workflows.
__*Default*__: false **pullRequestTemplate**?🔹 | boolean | Include a GitHub pull request template.
__*Default*__: true **pullRequestTemplateContents**?🔹 | Array | The contents of the pull request template.
__*Default*__: default content **readme**?🔹 | [SampleReadmeProps](#projen-samplereadmeprops) | The README setup.
__*Default*__: { filename: 'README.md', contents: '# replace this' } @@ -13671,7 +13685,7 @@ Name | Type | Description **minNodeVersion**?🔹 | string | Minimum Node.js version to require via package.json `engines` (inclusive).
__*Default*__: no "engines" specified **mutableBuild**?🔹 | boolean | Automatically update files modified during builds to pull-request branches.
__*Default*__: true **npmAccess**?🔹 | [javascript.NpmAccess](#projen-javascript-npmaccess) | Access level of the npm package.
__*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. -**npmDistTag**?🔹 | string | Tags can be used to provide an alias instead of version numbers.
__*Default*__: "latest" +**npmDistTag**?🔹 | string | The npmDistTag to use when publishing from the default branch.
__*Default*__: "latest" **npmRegistry**?⚠️ | string | The host name of the npm registry to publish to.
__*Optional*__ **npmRegistryUrl**?🔹 | string | The base URL of the npm package registry.
__*Default*__: "https://registry.npmjs.org" **npmTokenSecret**?🔹 | string | GitHub secret which contains the NPM token to use when publishing packages.
__*Default*__: "NPM_TOKEN" @@ -13696,6 +13710,7 @@ Name | Type | Description **projenrcJsOptions**?🔹 | [javascript.ProjenrcOptions](#projen-javascript-projenrcoptions) | Options for .projenrc.js.
__*Default*__: default options **projenrcJson**?🔹 | boolean | Generate (once) .projenrc.json (in JSON). Set to `false` in order to disable .projenrc.json generation.
__*Default*__: false **projenrcJsonOptions**?🔹 | [ProjenrcOptions](#projen-projenrcoptions) | Options for .projenrc.json.
__*Default*__: default options +**publishTasks**?🔹 | boolean | Define publishing tasks that can be executed manually as well as workflows.
__*Default*__: false **pullRequestTemplate**?🔹 | boolean | Include a GitHub pull request template.
__*Default*__: true **pullRequestTemplateContents**?🔹 | Array | The contents of the pull request template.
__*Default*__: default content **readme**?🔹 | [SampleReadmeProps](#projen-samplereadmeprops) | The README setup.
__*Default*__: { filename: 'README.md', contents: '# replace this' } @@ -13799,7 +13814,7 @@ Name | Type | Description **minNodeVersion**?🔹 | string | Minimum Node.js version to require via package.json `engines` (inclusive).
__*Default*__: no "engines" specified **mutableBuild**?🔹 | boolean | Automatically update files modified during builds to pull-request branches.
__*Default*__: true **npmAccess**?🔹 | [javascript.NpmAccess](#projen-javascript-npmaccess) | Access level of the npm package.
__*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. -**npmDistTag**?🔹 | string | Tags can be used to provide an alias instead of version numbers.
__*Default*__: "latest" +**npmDistTag**?🔹 | string | The npmDistTag to use when publishing from the default branch.
__*Default*__: "latest" **npmRegistry**?⚠️ | string | The host name of the npm registry to publish to.
__*Optional*__ **npmRegistryUrl**?🔹 | string | The base URL of the npm package registry.
__*Default*__: "https://registry.npmjs.org" **npmTokenSecret**?🔹 | string | GitHub secret which contains the NPM token to use when publishing packages.
__*Default*__: "NPM_TOKEN" @@ -13827,6 +13842,7 @@ Name | Type | Description **projenrcJsonOptions**?🔹 | [ProjenrcOptions](#projen-projenrcoptions) | Options for .projenrc.json.
__*Default*__: default options **projenrcTs**?🔹 | boolean | Use TypeScript for your projenrc file (`.projenrc.ts`).
__*Default*__: false **projenrcTsOptions**?🔹 | [typescript.ProjenrcOptions](#projen-typescript-projenrcoptions) | Options for .projenrc.ts.
__*Optional*__ +**publishTasks**?🔹 | boolean | Define publishing tasks that can be executed manually as well as workflows.
__*Default*__: false **pullRequestTemplate**?🔹 | boolean | Include a GitHub pull request template.
__*Default*__: true **pullRequestTemplateContents**?🔹 | Array | The contents of the pull request template.
__*Default*__: default content **readme**?🔹 | [SampleReadmeProps](#projen-samplereadmeprops) | The README setup.
__*Default*__: { filename: 'README.md', contents: '# replace this' } @@ -13956,7 +13972,7 @@ Name | Type | Description **minNodeVersion**?🔹 | string | Minimum Node.js version to require via package.json `engines` (inclusive).
__*Default*__: no "engines" specified **mutableBuild**?🔹 | boolean | Automatically update files modified during builds to pull-request branches.
__*Default*__: true **npmAccess**?🔹 | [javascript.NpmAccess](#projen-javascript-npmaccess) | Access level of the npm package.
__*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. -**npmDistTag**?🔹 | string | Tags can be used to provide an alias instead of version numbers.
__*Default*__: "latest" +**npmDistTag**?🔹 | string | The npmDistTag to use when publishing from the default branch.
__*Default*__: "latest" **npmRegistry**?⚠️ | string | The host name of the npm registry to publish to.
__*Optional*__ **npmRegistryUrl**?🔹 | string | The base URL of the npm package registry.
__*Default*__: "https://registry.npmjs.org" **npmTokenSecret**?🔹 | string | GitHub secret which contains the NPM token to use when publishing packages.
__*Default*__: "NPM_TOKEN" @@ -13981,6 +13997,7 @@ Name | Type | Description **projenrcJsOptions**?🔹 | [javascript.ProjenrcOptions](#projen-javascript-projenrcoptions) | Options for .projenrc.js.
__*Default*__: default options **projenrcJson**?🔹 | boolean | Generate (once) .projenrc.json (in JSON). Set to `false` in order to disable .projenrc.json generation.
__*Default*__: false **projenrcJsonOptions**?🔹 | [ProjenrcOptions](#projen-projenrcoptions) | Options for .projenrc.json.
__*Default*__: default options +**publishTasks**?🔹 | boolean | Define publishing tasks that can be executed manually as well as workflows.
__*Default*__: false **pullRequestTemplate**?🔹 | boolean | Include a GitHub pull request template.
__*Default*__: true **pullRequestTemplateContents**?🔹 | Array | The contents of the pull request template.
__*Default*__: default content **readme**?🔹 | [SampleReadmeProps](#projen-samplereadmeprops) | The README setup.
__*Default*__: { filename: 'README.md', contents: '# replace this' } @@ -14112,7 +14129,7 @@ Name | Type | Description **minNodeVersion**?🔹 | string | Minimum Node.js version to require via package.json `engines` (inclusive).
__*Default*__: no "engines" specified **mutableBuild**?🔹 | boolean | Automatically update files modified during builds to pull-request branches.
__*Default*__: true **npmAccess**?🔹 | [javascript.NpmAccess](#projen-javascript-npmaccess) | Access level of the npm package.
__*Default*__: for scoped packages (e.g. `foo@bar`), the default is `NpmAccess.RESTRICTED`, for non-scoped packages, the default is `NpmAccess.PUBLIC`. -**npmDistTag**?🔹 | string | Tags can be used to provide an alias instead of version numbers.
__*Default*__: "latest" +**npmDistTag**?🔹 | string | The npmDistTag to use when publishing from the default branch.
__*Default*__: "latest" **npmRegistry**?⚠️ | string | The host name of the npm registry to publish to.
__*Optional*__ **npmRegistryUrl**?🔹 | string | The base URL of the npm package registry.
__*Default*__: "https://registry.npmjs.org" **npmTokenSecret**?🔹 | string | GitHub secret which contains the NPM token to use when publishing packages.
__*Default*__: "NPM_TOKEN" @@ -14140,6 +14157,7 @@ Name | Type | Description **projenrcJsonOptions**?🔹 | [ProjenrcOptions](#projen-projenrcoptions) | Options for .projenrc.json.
__*Default*__: default options **projenrcTs**?🔹 | boolean | Use TypeScript for your projenrc file (`.projenrc.ts`).
__*Default*__: false **projenrcTsOptions**?🔹 | [typescript.ProjenrcOptions](#projen-typescript-projenrcoptions) | Options for .projenrc.ts.
__*Optional*__ +**publishTasks**?🔹 | boolean | Define publishing tasks that can be executed manually as well as workflows.
__*Default*__: false **pullRequestTemplate**?🔹 | boolean | Include a GitHub pull request template.
__*Default*__: true **pullRequestTemplateContents**?🔹 | Array | The contents of the pull request template.
__*Default*__: default content **readme**?🔹 | [SampleReadmeProps](#projen-samplereadmeprops) | The README setup.
__*Default*__: { filename: 'README.md', contents: '# replace this' } diff --git a/package.json b/package.json index 765bfcf7fd9..3ab02d064fa 100644 --- a/package.json +++ b/package.json @@ -24,10 +24,6 @@ "package": "/bin/bash ./projen.bash package", "post-compile": "/bin/bash ./projen.bash post-compile", "pre-compile": "/bin/bash ./projen.bash pre-compile", - "publish:github": "/bin/bash ./projen.bash publish:github", - "publish:maven": "/bin/bash ./projen.bash publish:maven", - "publish:npm": "/bin/bash ./projen.bash publish:npm", - "publish:pypi": "/bin/bash ./projen.bash publish:pypi", "readme-macros": "/bin/bash ./projen.bash readme-macros", "release": "/bin/bash ./projen.bash release", "test": "/bin/bash ./projen.bash test", diff --git a/src/cdk/jsii-project.ts b/src/cdk/jsii-project.ts index eaa49ddb017..d6701d5620c 100644 --- a/src/cdk/jsii-project.ts +++ b/src/cdk/jsii-project.ts @@ -209,7 +209,6 @@ export class JsiiProject extends TypeScriptProject { if (options.releaseToNpm != false) { this.publisher?.publishToNpm({ - distTag: this.package.npmDistTag, registry: this.package.npmRegistry, npmTokenSecret: this.package.npmTokenSecret, }); diff --git a/src/github/workflows.ts b/src/github/workflows.ts index c52e99dcec4..0e4d7a2573a 100644 --- a/src/github/workflows.ts +++ b/src/github/workflows.ts @@ -52,7 +52,6 @@ export class GithubWorkflow extends Component { private events: workflows.Triggers = { }; private jobs: Record = { }; - private _providers = new Array(); constructor(github: GitHub, name: string, options: GithubWorkflowOptions = {}) { super(github.project); @@ -108,33 +107,12 @@ export class GithubWorkflow extends Component { }; } - /** - * Add jobs from a dynamic source. Useful if a component creates jobs that - * may not be all available until project synthesis time. - * - * @param provider Source of jobs - */ - public addJobsLater(provider: IJobProvider) { - this._providers.push(provider); - } - private renderWorkflow() { - const allJobs = { ...this.jobs }; - - for (const provider of this._providers) { - for (const [name, job] of Object.entries(provider.renderJobs())) { - if (name in allJobs) { - throw new Error(`A job named ${name} already exists in workflow ${this.name}`); - } - allJobs[name] = job; - } - } - return { name: this.name, on: snakeCaseKeys(this.events), concurrency: this.concurrency, - jobs: renderJobs(allJobs), + jobs: renderJobs(this.jobs), }; } } diff --git a/src/javascript/node-package.ts b/src/javascript/node-package.ts index 9aa1062c6c2..33e2dd55207 100644 --- a/src/javascript/node-package.ts +++ b/src/javascript/node-package.ts @@ -13,7 +13,6 @@ import { exec, isTruthy, sorted, writeFile } from '../util'; const UNLICENSED = 'UNLICENSED'; const DEFAULT_NPM_REGISTRY_URL = 'https://registry.npmjs.org/'; -const DEFAULT_NPM_TAG = 'latest'; const GITHUB_PACKAGES_REGISTRY = 'npm.pkg.github.com'; const DEFAULT_NPM_TOKEN_SECRET = 'NPM_TOKEN'; const DEFAULT_GITHUB_TOKEN_SECRET = 'GITHUB_TOKEN'; @@ -233,24 +232,6 @@ export interface NodePackageOptions { */ readonly licensed?: boolean; - /** - * Tags can be used to provide an alias instead of version numbers. - * - * For example, a project might choose to have multiple streams of development - * and use a different tag for each stream, e.g., stable, beta, dev, canary. - * - * By default, the `latest` tag is used by npm to identify the current version - * of a package, and `npm install ` (without any `@` or `@` - * specifier) installs the latest tag. Typically, projects only use the - * `latest` tag for stable release versions, and use other tags for unstable - * versions such as prereleases. - * - * The `next` tag is used by some projects to identify the upcoming version. - * - * @default "latest" - */ - readonly npmDistTag?: string; - /** * The base URL of the npm package registry. * @@ -364,11 +345,6 @@ export class NodePackage extends Component { */ public readonly license?: string; - /** - * npm distribution tag - */ - public readonly npmDistTag: string; - /** * npm registry (e.g. `https://registry.npmjs.org`). Use `npmRegistryHost` to get just the host name. */ @@ -421,9 +397,8 @@ export class NodePackage extends Component { this.project.annotateGenerated(`/${this.lockFile}`); const { - npmDistTag, npmAccess, npmRegistry, npmRegistryUrl, npmTokenSecret, codeArtifactOptions, + npmAccess, npmRegistry, npmRegistryUrl, npmTokenSecret, codeArtifactOptions, } = this.parseNpmOptions(options); - this.npmDistTag = npmDistTag; this.npmAccess = npmAccess; this.npmRegistry = npmRegistry; this.npmRegistryUrl = npmRegistryUrl; @@ -788,7 +763,6 @@ export class NodePackage extends Component { } return { - npmDistTag: options.npmDistTag ?? DEFAULT_NPM_TAG, npmAccess, npmRegistry: npmr.hostname + this.renderNpmRegistryPath(npmr.pathname!), npmRegistryUrl: npmr.href, @@ -1005,7 +979,6 @@ export class NodePackage extends Component { // omit values if they are the same as the npm defaults return resolveJson({ registry: this.npmRegistryUrl !== DEFAULT_NPM_REGISTRY_URL ? this.npmRegistryUrl : undefined, - tag: this.npmDistTag !== DEFAULT_NPM_TAG ? this.npmDistTag : undefined, access: this.npmAccess !== defaultNpmAccess(this.packageName) ? this.npmAccess : undefined, }, { omitEmpty: true }); } diff --git a/src/javascript/node-project.ts b/src/javascript/node-project.ts index d8ed14f0592..f77e1215bd5 100644 --- a/src/javascript/node-project.ts +++ b/src/javascript/node-project.ts @@ -360,16 +360,6 @@ export class NodeProject extends GitHubProject { */ public readonly antitamper: boolean; - /** - * @deprecated use `package.npmDistTag` - */ - protected readonly npmDistTag: string; - - /** - * @deprecated use `package.npmRegistry` - */ - protected readonly npmRegistry: string; - /** * The package manager to use. * @@ -424,9 +414,6 @@ export class NodeProject extends GitHubProject { this.addLicense(options); - this.npmDistTag = this.package.npmDistTag; - this.npmRegistry = this.package.npmRegistry; - if (options.npmignoreEnabled ?? true) { this.npmignore = new IgnoreFile(this, '.npmignore'); } @@ -623,7 +610,6 @@ export class NodeProject extends GitHubProject { if (options.releaseToNpm ?? false) { this.release.publisher.publishToNpm({ - distTag: this.package.npmDistTag, registry: this.package.npmRegistry, npmTokenSecret: this.package.npmTokenSecret, codeArtifactOptions: { diff --git a/src/release/publisher.ts b/src/release/publisher.ts index 37290221963..2dba34aee51 100644 --- a/src/release/publisher.ts +++ b/src/release/publisher.ts @@ -1,5 +1,5 @@ +import { BranchOptions } from '.'; import { Component } from '../component'; -import { IJobProvider, workflows } from '../github'; import { DEFAULT_GITHUB_ACTIONS_USER } from '../github/constants'; import { Job, JobPermission, JobPermissions } from '../github/workflows-model'; import { defaultNpmToken } from '../javascript/node-package'; @@ -66,6 +66,16 @@ export interface PublisherOptions { * @default ["ubuntu-latest"] */ readonly workflowRunsOn?: string[]; + + /** + * Define publishing tasks that can be executed manually as well as workflows. + * + * Normally, publishing only happens within automated workflows. Enable this + * in order to create a publishing task for each publishing activity. + * + * @default false + */ + readonly publishTasks?: boolean; } /** @@ -73,7 +83,7 @@ export interface PublisherOptions { * * Under the hood, it uses https://github.com/aws/jsii-release */ -export class Publisher extends Component implements IJobProvider { +export class Publisher extends Component { public readonly buildJobId: string; public readonly artifactName: string; public readonly jsiiReleaseVersion: string; @@ -82,9 +92,10 @@ export class Publisher extends Component implements IJobProvider { private readonly failureIssue: boolean; private readonly failureIssueLabel: string; private readonly runsOn: string[]; + private readonly publishTasks: boolean; - // the jobs to add to the release workflow - private readonly _jobs: { [name: string]: workflows.Job } = {}; + // functions that create jobs associated with a specific branch + private readonly _jobFactories: PublishJobFactory[] = []; constructor(project: Project, options: PublisherOptions) { super(project); @@ -97,14 +108,28 @@ export class Publisher extends Component implements IJobProvider { this.failureIssue = options.failureIssue ?? false; this.failureIssueLabel = options.failureIssueLabel ?? 'failed-release'; this.runsOn = options.workflowRunsOn ?? ['ubuntu-latest']; + this.publishTasks = options.publishTasks ?? false; } /** - * Renders a set of workflow jobs for all the publishers. - * @returns GitHub workflow jobs + * Called by `Release` to add the publishing jobs to a release workflow + * associated with a specific branch. + * @param branch The branch name + * @param options Branch options + * + * @internal */ - public renderJobs(): Record { - return { ...this._jobs }; + public _renderJobsForBranch(branch: string, options: Partial): Record { + let jobs: Record = {}; + + for (const factory of this._jobFactories) { + jobs = { + ...jobs, + ...factory(branch, options), + }; + } + + return jobs; } /** @@ -175,18 +200,20 @@ export class Publisher extends Component implements IJobProvider { 'fi', ].join(' '); - this.addPublishJob({ - name: 'github', - registryName: 'GitHub Releases', - permissions: { - contents: JobPermission.WRITE, - }, - workflowEnv: { - GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}', - GITHUB_REPOSITORY: '${{ github.repository }}', - GITHUB_REF: '${{ github.ref }}', - }, - run: idempotentRelease, + this.addPublishJob(() => { + return { + name: 'github', + registryName: 'GitHub Releases', + permissions: { + contents: JobPermission.WRITE, + }, + workflowEnv: { + GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}', + GITHUB_REPOSITORY: '${{ github.repository }}', + GITHUB_REF: '${{ github.ref }}', + }, + run: idempotentRelease, + }; }); } @@ -199,26 +226,36 @@ export class Publisher extends Component implements IJobProvider { const isAwsCodeArtifact = isAwsCodeArtifactRegistry(options.registry); const npmToken = defaultNpmToken(options.npmTokenSecret, options.registry); - this.addPublishJob({ - name: 'npm', - run: this.jsiiReleaseCommand('jsii-release-npm'), - containerImage: JSII_RELEASE_IMAGE, - registryName: 'npm', - env: { - NPM_DIST_TAG: options.distTag, - NPM_REGISTRY: options.registry, - }, - permissions: { - contents: JobPermission.READ, - packages: isGitHubPackages ? JobPermission.WRITE : undefined, - }, - workflowEnv: { - NPM_TOKEN: npmToken ? secret(npmToken) : undefined, - // if we are publishing to AWS CodeArtifact, pass AWS access keys that will be used to generate NPM_TOKEN using AWS CLI. - AWS_ACCESS_KEY_ID: isAwsCodeArtifact ? secret(options.codeArtifactOptions?.accessKeyIdSecret ?? 'AWS_ACCESS_KEY_ID') : undefined, - AWS_SECRET_ACCESS_KEY: isAwsCodeArtifact ? secret(options.codeArtifactOptions?.secretAccessKeySecret ?? 'AWS_SECRET_ACCESS_KEY') : undefined, - AWS_ROLE_TO_ASSUME: isAwsCodeArtifact ? options.codeArtifactOptions?.roleToAssume : undefined, - }, + if (options.distTag) { + this.project.logger.warn('The `distTag` option is deprecated. Use the npmDistTag option instead.'); + } + + this.addPublishJob((_branch, branchOptions) => { + if (branchOptions.npmDistTag && options.distTag) { + throw new Error('cannot set branch-level npmDistTag and npmDistTag in publishToNpm()'); + } + + return { + name: 'npm', + run: this.jsiiReleaseCommand('jsii-release-npm'), + containerImage: JSII_RELEASE_IMAGE, + registryName: 'npm', + env: { + NPM_DIST_TAG: branchOptions.npmDistTag ?? options.distTag ?? 'latest', + NPM_REGISTRY: options.registry, + }, + permissions: { + contents: JobPermission.READ, + packages: isGitHubPackages ? JobPermission.WRITE : undefined, + }, + workflowEnv: { + NPM_TOKEN: npmToken ? secret(npmToken) : undefined, + // if we are publishing to AWS CodeArtifact, pass AWS access keys that will be used to generate NPM_TOKEN using AWS CLI. + AWS_ACCESS_KEY_ID: isAwsCodeArtifact ? secret(options.codeArtifactOptions?.accessKeyIdSecret ?? 'AWS_ACCESS_KEY_ID') : undefined, + AWS_SECRET_ACCESS_KEY: isAwsCodeArtifact ? secret(options.codeArtifactOptions?.secretAccessKeySecret ?? 'AWS_SECRET_ACCESS_KEY') : undefined, + AWS_ROLE_TO_ASSUME: isAwsCodeArtifact ? options.codeArtifactOptions?.roleToAssume : undefined, + }, + }; }); } @@ -227,7 +264,7 @@ export class Publisher extends Component implements IJobProvider { * @param options Options */ public publishToNuget(options: NugetPublishOptions = {}) { - this.addPublishJob({ + this.addPublishJob((_branch, _branchOptions) => ({ name: 'nuget', containerImage: JSII_RELEASE_IMAGE, run: this.jsiiReleaseCommand('jsii-release-nuget'), @@ -235,7 +272,7 @@ export class Publisher extends Component implements IJobProvider { workflowEnv: { NUGET_API_KEY: secret(options.nugetApiKeySecret ?? 'NUGET_API_KEY'), }, - }); + })); } /** @@ -251,7 +288,7 @@ export class Publisher extends Component implements IJobProvider { throw new Error('publishing to GitHub Packages requires the "mavenServerId" to be "github"'); } - this.addPublishJob({ + this.addPublishJob((_branch, _branchOptions) => ({ name: 'maven', registryName: 'Maven Central', containerImage: JSII_RELEASE_IMAGE, @@ -272,7 +309,7 @@ export class Publisher extends Component implements IJobProvider { contents: JobPermission.READ, packages: isGitHubPackages ? JobPermission.WRITE : undefined, }, - }); + })); } /** @@ -280,7 +317,7 @@ export class Publisher extends Component implements IJobProvider { * @param options Options */ public publishToPyPi(options: PyPiPublishOptions = {}) { - this.addPublishJob({ + this.addPublishJob((_branch, _branchOptions) => ({ name: 'pypi', registryName: 'PyPI', run: this.jsiiReleaseCommand('jsii-release-pypi'), @@ -292,7 +329,7 @@ export class Publisher extends Component implements IJobProvider { TWINE_USERNAME: secret(options.twineUsernameSecret ?? 'TWINE_USERNAME'), TWINE_PASSWORD: secret(options.twinePasswordSecret ?? 'TWINE_PASSWORD'), }, - }); + })); } /** @@ -300,7 +337,7 @@ export class Publisher extends Component implements IJobProvider { * @param options Options */ public publishToGo(options: GoPublishOptions = {}) { - this.addPublishJob({ + this.addPublishJob((_branch, _branchOptions) => ({ name: 'golang', run: this.jsiiReleaseCommand('jsii-release-golang'), containerImage: JSII_RELEASE_IMAGE, @@ -315,91 +352,104 @@ export class Publisher extends Component implements IJobProvider { workflowEnv: { GITHUB_TOKEN: secret(options.githubTokenSecret ?? 'GO_GITHUB_TOKEN'), }, - }); + })); } - private addPublishJob(opts: PublishJobOptions) { - const jobname = `release_${opts.name}`; - if (jobname in this._jobs) { - throw new Error(`Duplicate job with name "${jobname}"`); - } + private addPublishJob(factory: (branch: string, branchOptions: Partial) => PublishJobOptions) { + this._jobFactories.push((branch, branchOptions) => { + const opts = factory(branch, branchOptions); + const jobname = `release_${opts.name}`; + if (jobname in this._jobFactories) { + throw new Error(`Duplicate job with name "${jobname}"`); + } - const requiredEnv = new Array(); + const requiredEnv = new Array(); - // jobEnv is the env we pass to the github job (task environment + secrets/expressions). - const jobEnv: Record = { ...opts.env }; - const workflowEnvEntries = Object.entries(opts.workflowEnv ?? {}) - .filter(([_, value]) => value != undefined) as string[][]; - for (const [name, expression] of workflowEnvEntries) { - requiredEnv.push(name); - jobEnv[name] = expression; - } + // jobEnv is the env we pass to the github job (task environment + secrets/expressions). + const jobEnv: Record = { ...opts.env }; + const workflowEnvEntries = Object.entries(opts.workflowEnv ?? {}) + .filter(([_, value]) => value != undefined) as string[][]; + for (const [name, expression] of workflowEnvEntries) { + requiredEnv.push(name); + jobEnv[name] = expression; + } - // define a task which can be used through `projen publish:xxx`. - this.project.addTask(`publish:${opts.name.toLocaleLowerCase()}`, { - description: `Publish this package to ${opts.registryName}`, - env: opts.env, - requiredEnv: requiredEnv, - exec: opts.run, - }); + if (this.publishTasks) { + const branchSuffix = (branch === 'main' || branch === 'master') ? '' : `:${branch}`; - const steps: any[] = [ - { - name: 'Download build artifacts', - uses: 'actions/download-artifact@v2', - with: { - name: this.artifactName, - path: ARTIFACTS_DOWNLOAD_DIR, // this must be "dist" for jsii-release - }, - }, - { - name: 'Release', - // it would have been nice if we could just run "projen publish:xxx" here but that is not possible because this job does not checkout sources - run: opts.run, - env: jobEnv, - }, - ]; + // define a task which can be used through `projen publish:xxx`. + const task = this.project.addTask(`publish:${opts.name.toLocaleLowerCase()}${branchSuffix}`, { + description: `Publish this package to ${opts.registryName}`, + env: opts.env, + requiredEnv: requiredEnv, + }); + + // first verify that we are on the correct branch + task.exec(`test "$(git branch --show-current)" = "${branch}"`); - const perms = opts.permissions ?? { contents: JobPermission.READ }; + // run commands + task.exec(opts.run); + } - if (this.failureIssue) { - steps.push(...[ + + const steps: any[] = [ { - name: 'Extract Version', - if: '${{ failure() }}', - id: 'extract-version', - run: 'echo "::set-output name=VERSION::$(cat dist/version.txt)"', + name: 'Download build artifacts', + uses: 'actions/download-artifact@v2', + with: { + name: this.artifactName, + path: ARTIFACTS_DOWNLOAD_DIR, // this must be "dist" for jsii-release + }, }, { - name: 'Create Issue', - if: '${{ failure() }}', - uses: 'imjohnbo/issue-bot@v3', - with: { - labels: this.failureIssueLabel, - title: `Publishing v\${{ steps.extract-version.outputs.VERSION }} to ${opts.registryName} failed`, - body: 'See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}', + name: 'Release', + // it would have been nice if we could just run "projen publish:xxx" here but that is not possible because this job does not checkout sources + run: opts.run, + env: jobEnv, + }, + ]; + + const perms = opts.permissions ?? { contents: JobPermission.READ }; + + if (this.failureIssue) { + steps.push(...[ + { + name: 'Extract Version', + if: '${{ failure() }}', + id: 'extract-version', + run: 'echo "::set-output name=VERSION::$(cat dist/version.txt)"', }, - env: { - GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}', + { + name: 'Create Issue', + if: '${{ failure() }}', + uses: 'imjohnbo/issue-bot@v3', + with: { + labels: this.failureIssueLabel, + title: `Publishing v\${{ steps.extract-version.outputs.VERSION }} to ${opts.registryName} failed`, + body: 'See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}', + }, + env: { + GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}', + }, }, + ]); + Object.assign(perms, { issues: JobPermission.WRITE }); + } + + return { + [jobname]: { + name: `Publish to ${opts.registryName}`, + permissions: perms, + if: this.condition, + needs: [this.buildJobId], + runsOn: this.runsOn, + container: opts.containerImage ? { + image: opts.containerImage, + } : undefined, + steps, }, - ]); - Object.assign(perms, { issues: JobPermission.WRITE }); - } - - const job: Job = { - name: `Publish to ${opts.registryName}`, - permissions: perms, - if: this.condition, - needs: [this.buildJobId], - runsOn: this.runsOn, - container: opts.containerImage ? { - image: opts.containerImage, - } : undefined, - steps, - }; - - this._jobs[jobname] = job; + }; + }); } private jsiiReleaseCommand(command: string) { @@ -473,6 +523,7 @@ export interface NpmPublishOptions { * The `next` tag is used by some projects to identify the upcoming version. * * @default "latest" + * @deprecated Use `npmDistTag` for each release branch instead. */ readonly distTag?: string; @@ -773,3 +824,5 @@ export interface GitPublishOptions extends VersionArtifactOptions { */ readonly gitPushCommand?: string; } + +type PublishJobFactory = (branch: string, branchOptions: Partial) => Record; \ No newline at end of file diff --git a/src/release/release.ts b/src/release/release.ts index fe4ad3a4fce..e24034b6472 100644 --- a/src/release/release.ts +++ b/src/release/release.ts @@ -1,6 +1,6 @@ import * as path from 'path'; import { Component } from '../component'; -import { GitHub, GitHubProject, TaskWorkflow } from '../github'; +import { GitHub, GitHubProject, GithubWorkflow, TaskWorkflow } from '../github'; import { Job, JobPermission, JobStep } from '../github/workflows-model'; import { Task } from '../task'; import { Version } from '../version'; @@ -96,6 +96,16 @@ export interface ReleaseProjectOptions { */ readonly prerelease?: string; + /** + * The npmDistTag to use when publishing from the default branch. + * + * To set the npm dist-tag for release branches, set the `npmDistTag` property + * for each branch. + * + * @default "latest" + */ + readonly npmDistTag?: string; + /** * The name of the default release workflow. * @@ -158,6 +168,16 @@ export interface ReleaseProjectOptions { * @default ["ubuntu-latest"] */ readonly workflowRunsOn?: string[]; + + /** + * Define publishing tasks that can be executed manually as well as workflows. + * + * Normally, publishing only happens within automated workflows. Enable this + * in order to create a publishing task for each publishing activity. + * + * @default false + */ + readonly publishTasks?: boolean; } /** @@ -268,6 +288,7 @@ export class Release extends Component { failureIssue: options.releaseFailureIssue, failureIssueLabel: options.releaseFailureIssueLabel, workflowRunsOn: options.workflowRunsOn, + publishTasks: options.publishTasks, }); const githubRelease = options.githubRelease ?? true; @@ -279,22 +300,14 @@ export class Release extends Component { }); } - // add the default branch - this.defaultBranch = { - name: options.branch, + // add the default branch (we need the internal method which does not require majorVersion) + this.defaultBranch = this._addBranch(options.branch, { prerelease: options.prerelease, majorVersion: options.majorVersion, workflowName: options.releaseWorkflowName ?? 'release', tagPrefix: options.releaseTagPrefix, - }; - - this._branches.push(this.defaultBranch); - - const defaultWorkflow = this.createWorkflow(this.defaultBranch); - if (defaultWorkflow) { - defaultWorkflow.addJobsLater(this.publisher); - defaultWorkflow.addJobsLater({ renderJobs: () => this.jobs }); - } + npmDistTag: options.npmDistTag, + }); for (const [name, opts] of Object.entries(options.releaseBranches ?? {})) { this.addBranch(name, opts); @@ -312,27 +325,49 @@ export class Release extends Component { * @param options Branch definition */ public addBranch(branch: string, options: BranchOptions) { + this._addBranch(branch, options); + } + + /** + * Adds a release branch. + * + * It is a git branch from which releases are published. If a project has more than one release + * branch, we require that `majorVersion` is also specified for the primary branch in order to + * ensure branches always release the correct version. + * + * @param branch The branch to monitor (e.g. `main`, `v2.x`) + * @param options Branch definition + */ + private _addBranch(branch: string, options: Partial): ReleaseBranch { if (this._branches.find(b => b.name === branch)) { throw new Error(`The release branch ${branch} is already defined`); } // if we add a branch, we require that the default branch will also define a // major version. - if (this.defaultBranch.majorVersion === undefined) { + if (this.defaultBranch && options.majorVersion && this.defaultBranch.majorVersion === undefined) { throw new Error('you must specify "majorVersion" for the default branch when adding multiple release branches'); } - const branchOptions = { + const releaseBranch: ReleaseBranch = { name: branch, ...options, + workflow: this.createWorkflow(branch, options), }; - this._branches.push(branchOptions); + this._branches.push(releaseBranch); + + return releaseBranch; + } - const workflow = this.createWorkflow(branchOptions); - if (workflow) { - workflow.addJobsLater(this.publisher); - workflow.addJobsLater({ renderJobs: () => this.jobs }); + public preSynthesize() { + for (const branch of this._branches) { + if (!branch.workflow) { + continue; + } + + branch.workflow.addJobs(this.publisher._renderJobsForBranch(branch.name, branch)); + branch.workflow.addJobs(this.jobs); } } @@ -356,8 +391,8 @@ export class Release extends Component { /** * @returns a workflow or `undefined` if github integration is disabled. */ - private createWorkflow(branch: ReleaseBranch): TaskWorkflow | undefined { - const workflowName = branch.workflowName ?? `release-${branch.name}`; + private createWorkflow(branchName: string, branch: Partial): TaskWorkflow | undefined { + const workflowName = branch.workflowName ?? `release-${branchName}`; // to avoid race conditions between two commits trying to release the same // version, we check if the head sha is identical to the remote sha. if @@ -389,9 +424,9 @@ export class Release extends Component { // if this is the release for "main" or "master", just call it "release". // otherwise, "release:BRANCH" - const releaseTaskName = (branch.name === 'main' || branch.name === 'master') ? 'release' : `release:${branch.name}`; + const releaseTaskName = (branchName === 'main' || branchName === 'master') ? 'release' : `release:${branchName}`; const releaseTask = this.project.addTask(releaseTaskName, { - description: `Prepare a release from "${branch.name}" branch`, + description: `Prepare a release from "${branchName}" branch`, env, }); @@ -406,7 +441,7 @@ export class Release extends Component { versionFile: path.posix.join(this.artifactsDirectory, this.version.versionFileName), releaseTagFile: path.posix.join(this.artifactsDirectory, this.version.releaseTagFileName), projectChangelogFile: this.releaseTrigger.changelogPath, - gitBranch: branch.name, + gitBranch: branchName, gitPushCommand: this.releaseTrigger.gitPushCommand, }); @@ -451,7 +486,7 @@ export class Release extends Component { }, triggers: { schedule: this.releaseTrigger.schedule ? [{ cron: this.releaseTrigger.schedule }] : undefined, - push: this.releaseTrigger.isContinuous ? { branches: [branch.name] } : undefined, + push: this.releaseTrigger.isContinuous ? { branches: [branchName] } : undefined, }, container: this.containerImage ? { image: this.containerImage } : undefined, env: { @@ -511,8 +546,16 @@ export interface BranchOptions { * @default - no prefix */ readonly tagPrefix?: string; + + /** + * The npm distribution tag to use for this branch. + * + * @default "latest" + */ + readonly npmDistTag?: string; } interface ReleaseBranch extends Partial { + readonly workflow?: GithubWorkflow; readonly name: string; } diff --git a/test/__snapshots__/integ.test.ts.snap b/test/__snapshots__/integ.test.ts.snap index ca675b83c57..b3055a17673 100644 --- a/test/__snapshots__/integ.test.ts.snap +++ b/test/__snapshots__/integ.test.ts.snap @@ -1128,65 +1128,6 @@ UNEXPECTED BREAKING CHANGES: add keys such as 'removed:constructs.Node.of' to .c "description": "Prepare the project for compilation", "name": "pre-compile", }, - "publish:github": Object { - "description": "Publish this package to GitHub Releases", - "name": "publish:github", - "requiredEnv": Array [ - "GITHUB_TOKEN", - "GITHUB_REPOSITORY", - "GITHUB_REF", - ], - "steps": Array [ - Object { - "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \\"Release.tag_name already exists\\" $errout; then cat $errout; exit $exitcode; fi", - }, - ], - }, - "publish:maven": Object { - "description": "Publish this package to Maven Central", - "name": "publish:maven", - "requiredEnv": Array [ - "MAVEN_GPG_PRIVATE_KEY", - "MAVEN_GPG_PRIVATE_KEY_PASSPHRASE", - "MAVEN_PASSWORD", - "MAVEN_USERNAME", - "MAVEN_STAGING_PROFILE_ID", - ], - "steps": Array [ - Object { - "exec": "npx -p jsii-release@latest jsii-release-maven", - }, - ], - }, - "publish:npm": Object { - "description": "Publish this package to npm", - "env": Object { - "NPM_DIST_TAG": "latest", - "NPM_REGISTRY": "registry.npmjs.org", - }, - "name": "publish:npm", - "requiredEnv": Array [ - "NPM_TOKEN", - ], - "steps": Array [ - Object { - "exec": "npx -p jsii-release@latest jsii-release-npm", - }, - ], - }, - "publish:pypi": Object { - "description": "Publish this package to PyPI", - "name": "publish:pypi", - "requiredEnv": Array [ - "TWINE_USERNAME", - "TWINE_PASSWORD", - ], - "steps": Array [ - Object { - "exec": "npx -p jsii-release@latest jsii-release-pypi", - }, - ], - }, "release": Object { "description": "Prepare a release from \\"master\\" branch", "env": Object { @@ -1727,10 +1668,6 @@ project.synth(); "post-compile": "npx projen post-compile", "pre-compile": "npx projen pre-compile", "projen": "npx projen", - "publish:github": "npx projen publish:github", - "publish:maven": "npx projen publish:maven", - "publish:npm": "npx projen publish:npm", - "publish:pypi": "npx projen publish:pypi", "release": "npx projen release", "test": "npx projen test", "test:update": "npx projen test:update", @@ -5209,20 +5146,6 @@ junit.xml "description": "Prepare the project for compilation", "name": "pre-compile", }, - "publish:github": Object { - "description": "Publish this package to GitHub Releases", - "name": "publish:github", - "requiredEnv": Array [ - "GITHUB_TOKEN", - "GITHUB_REPOSITORY", - "GITHUB_REF", - ], - "steps": Array [ - Object { - "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \\"Release.tag_name already exists\\" $errout; then cat $errout; exit $exitcode; fi", - }, - ], - }, "release": Object { "description": "Prepare a release from \\"master\\" branch", "env": Object { @@ -5637,7 +5560,6 @@ project.synth(); "post-compile": "npx projen post-compile", "pre-compile": "npx projen pre-compile", "projen": "npx projen", - "publish:github": "npx projen publish:github", "release": "npx projen release", "test": "npx projen test", "test:update": "npx projen test:update", diff --git a/test/__snapshots__/inventory.test.ts.snap b/test/__snapshots__/inventory.test.ts.snap index 4df5e0ff854..b0f208a5548 100644 --- a/test/__snapshots__/inventory.test.ts.snap +++ b/test/__snapshots__/inventory.test.ts.snap @@ -2082,7 +2082,7 @@ Array [ }, Object { "default": "\\"latest\\"", - "docs": "Tags can be used to provide an alias instead of version numbers.", + "docs": "The npmDistTag to use when publishing from the default branch.", "featured": false, "fullType": Object { "primitive": "string", @@ -2090,7 +2090,7 @@ Array [ "jsonLike": true, "name": "npmDistTag", "optional": true, - "parent": "NodePackageOptions", + "parent": "ReleaseProjectOptions", "path": Array [ "npmDistTag", ], @@ -2589,6 +2589,23 @@ Array [ "simpleType": "string", "switch": "projen-version", }, + Object { + "default": "false", + "docs": "Define publishing tasks that can be executed manually as well as workflows.", + "featured": false, + "fullType": Object { + "primitive": "boolean", + }, + "jsonLike": true, + "name": "publishTasks", + "optional": true, + "parent": "ReleaseProjectOptions", + "path": Array [ + "publishTasks", + ], + "simpleType": "boolean", + "switch": "publish-tasks", + }, Object { "default": "true", "docs": "Include a GitHub pull request template.", @@ -4662,7 +4679,7 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", }, Object { "default": "\\"latest\\"", - "docs": "Tags can be used to provide an alias instead of version numbers.", + "docs": "The npmDistTag to use when publishing from the default branch.", "featured": false, "fullType": Object { "primitive": "string", @@ -4670,7 +4687,7 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", "jsonLike": true, "name": "npmDistTag", "optional": true, - "parent": "NodePackageOptions", + "parent": "ReleaseProjectOptions", "path": Array [ "npmDistTag", ], @@ -5169,6 +5186,23 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", "simpleType": "string", "switch": "projen-version", }, + Object { + "default": "false", + "docs": "Define publishing tasks that can be executed manually as well as workflows.", + "featured": false, + "fullType": Object { + "primitive": "boolean", + }, + "jsonLike": true, + "name": "publishTasks", + "optional": true, + "parent": "ReleaseProjectOptions", + "path": Array [ + "publishTasks", + ], + "simpleType": "boolean", + "switch": "publish-tasks", + }, Object { "default": "- no publishing", "docs": "Publish Go bindings to a git repository.", @@ -7132,7 +7166,7 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", }, Object { "default": "\\"latest\\"", - "docs": "Tags can be used to provide an alias instead of version numbers.", + "docs": "The npmDistTag to use when publishing from the default branch.", "featured": false, "fullType": Object { "primitive": "string", @@ -7140,7 +7174,7 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", "jsonLike": true, "name": "npmDistTag", "optional": true, - "parent": "NodePackageOptions", + "parent": "ReleaseProjectOptions", "path": Array [ "npmDistTag", ], @@ -7639,6 +7673,23 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", "simpleType": "string", "switch": "projen-version", }, + Object { + "default": "false", + "docs": "Define publishing tasks that can be executed manually as well as workflows.", + "featured": false, + "fullType": Object { + "primitive": "boolean", + }, + "jsonLike": true, + "name": "publishTasks", + "optional": true, + "parent": "ReleaseProjectOptions", + "path": Array [ + "publishTasks", + ], + "simpleType": "boolean", + "switch": "publish-tasks", + }, Object { "default": "true", "docs": "Include a GitHub pull request template.", @@ -9549,7 +9600,7 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", }, Object { "default": "\\"latest\\"", - "docs": "Tags can be used to provide an alias instead of version numbers.", + "docs": "The npmDistTag to use when publishing from the default branch.", "featured": false, "fullType": Object { "primitive": "string", @@ -9557,7 +9608,7 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", "jsonLike": true, "name": "npmDistTag", "optional": true, - "parent": "NodePackageOptions", + "parent": "ReleaseProjectOptions", "path": Array [ "npmDistTag", ], @@ -10056,6 +10107,23 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", "simpleType": "string", "switch": "projen-version", }, + Object { + "default": "false", + "docs": "Define publishing tasks that can be executed manually as well as workflows.", + "featured": false, + "fullType": Object { + "primitive": "boolean", + }, + "jsonLike": true, + "name": "publishTasks", + "optional": true, + "parent": "ReleaseProjectOptions", + "path": Array [ + "publishTasks", + ], + "simpleType": "boolean", + "switch": "publish-tasks", + }, Object { "default": "- no publishing", "docs": "Publish Go bindings to a git repository.", @@ -12024,7 +12092,7 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", }, Object { "default": "\\"latest\\"", - "docs": "Tags can be used to provide an alias instead of version numbers.", + "docs": "The npmDistTag to use when publishing from the default branch.", "featured": false, "fullType": Object { "primitive": "string", @@ -12032,7 +12100,7 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", "jsonLike": true, "name": "npmDistTag", "optional": true, - "parent": "NodePackageOptions", + "parent": "ReleaseProjectOptions", "path": Array [ "npmDistTag", ], @@ -12531,6 +12599,23 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", "simpleType": "string", "switch": "projen-version", }, + Object { + "default": "false", + "docs": "Define publishing tasks that can be executed manually as well as workflows.", + "featured": false, + "fullType": Object { + "primitive": "boolean", + }, + "jsonLike": true, + "name": "publishTasks", + "optional": true, + "parent": "ReleaseProjectOptions", + "path": Array [ + "publishTasks", + ], + "simpleType": "boolean", + "switch": "publish-tasks", + }, Object { "default": "- no publishing", "docs": "Publish Go bindings to a git repository.", @@ -15153,7 +15238,7 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", }, Object { "default": "\\"latest\\"", - "docs": "Tags can be used to provide an alias instead of version numbers.", + "docs": "The npmDistTag to use when publishing from the default branch.", "featured": false, "fullType": Object { "primitive": "string", @@ -15161,7 +15246,7 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", "jsonLike": true, "name": "npmDistTag", "optional": true, - "parent": "NodePackageOptions", + "parent": "ReleaseProjectOptions", "path": Array [ "npmDistTag", ], @@ -15660,6 +15745,23 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", "simpleType": "string", "switch": "projen-version", }, + Object { + "default": "false", + "docs": "Define publishing tasks that can be executed manually as well as workflows.", + "featured": false, + "fullType": Object { + "primitive": "boolean", + }, + "jsonLike": true, + "name": "publishTasks", + "optional": true, + "parent": "ReleaseProjectOptions", + "path": Array [ + "publishTasks", + ], + "simpleType": "boolean", + "switch": "publish-tasks", + }, Object { "default": "- no publishing", "docs": "Publish Go bindings to a git repository.", @@ -17384,7 +17486,7 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", }, Object { "default": "\\"latest\\"", - "docs": "Tags can be used to provide an alias instead of version numbers.", + "docs": "The npmDistTag to use when publishing from the default branch.", "featured": false, "fullType": Object { "primitive": "string", @@ -17392,7 +17494,7 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", "jsonLike": true, "name": "npmDistTag", "optional": true, - "parent": "NodePackageOptions", + "parent": "ReleaseProjectOptions", "path": Array [ "npmDistTag", ], @@ -17839,6 +17941,23 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", "simpleType": "string", "switch": "projen-version", }, + Object { + "default": "false", + "docs": "Define publishing tasks that can be executed manually as well as workflows.", + "featured": false, + "fullType": Object { + "primitive": "boolean", + }, + "jsonLike": true, + "name": "publishTasks", + "optional": true, + "parent": "ReleaseProjectOptions", + "path": Array [ + "publishTasks", + ], + "simpleType": "boolean", + "switch": "publish-tasks", + }, Object { "default": "true", "docs": "Include a GitHub pull request template.", @@ -19486,7 +19605,7 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", }, Object { "default": "\\"latest\\"", - "docs": "Tags can be used to provide an alias instead of version numbers.", + "docs": "The npmDistTag to use when publishing from the default branch.", "featured": false, "fullType": Object { "primitive": "string", @@ -19494,7 +19613,7 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", "jsonLike": true, "name": "npmDistTag", "optional": true, - "parent": "NodePackageOptions", + "parent": "ReleaseProjectOptions", "path": Array [ "npmDistTag", ], @@ -19993,6 +20112,23 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", "simpleType": "string", "switch": "projen-version", }, + Object { + "default": "false", + "docs": "Define publishing tasks that can be executed manually as well as workflows.", + "featured": false, + "fullType": Object { + "primitive": "boolean", + }, + "jsonLike": true, + "name": "publishTasks", + "optional": true, + "parent": "ReleaseProjectOptions", + "path": Array [ + "publishTasks", + ], + "simpleType": "boolean", + "switch": "publish-tasks", + }, Object { "default": "true", "docs": "Include a GitHub pull request template.", @@ -21591,7 +21727,7 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", }, Object { "default": "\\"latest\\"", - "docs": "Tags can be used to provide an alias instead of version numbers.", + "docs": "The npmDistTag to use when publishing from the default branch.", "featured": false, "fullType": Object { "primitive": "string", @@ -21599,7 +21735,7 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", "jsonLike": true, "name": "npmDistTag", "optional": true, - "parent": "NodePackageOptions", + "parent": "ReleaseProjectOptions", "path": Array [ "npmDistTag", ], @@ -22046,6 +22182,23 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", "simpleType": "string", "switch": "projen-version", }, + Object { + "default": "false", + "docs": "Define publishing tasks that can be executed manually as well as workflows.", + "featured": false, + "fullType": Object { + "primitive": "boolean", + }, + "jsonLike": true, + "name": "publishTasks", + "optional": true, + "parent": "ReleaseProjectOptions", + "path": Array [ + "publishTasks", + ], + "simpleType": "boolean", + "switch": "publish-tasks", + }, Object { "default": "true", "docs": "Include a GitHub pull request template.", @@ -24417,7 +24570,7 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", }, Object { "default": "\\"latest\\"", - "docs": "Tags can be used to provide an alias instead of version numbers.", + "docs": "The npmDistTag to use when publishing from the default branch.", "featured": false, "fullType": Object { "primitive": "string", @@ -24425,7 +24578,7 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", "jsonLike": true, "name": "npmDistTag", "optional": true, - "parent": "NodePackageOptions", + "parent": "ReleaseProjectOptions", "path": Array [ "npmDistTag", ], @@ -24872,6 +25025,23 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", "simpleType": "string", "switch": "projen-version", }, + Object { + "default": "false", + "docs": "Define publishing tasks that can be executed manually as well as workflows.", + "featured": false, + "fullType": Object { + "primitive": "boolean", + }, + "jsonLike": true, + "name": "publishTasks", + "optional": true, + "parent": "ReleaseProjectOptions", + "path": Array [ + "publishTasks", + ], + "simpleType": "boolean", + "switch": "publish-tasks", + }, Object { "default": "true", "docs": "Include a GitHub pull request template.", @@ -26507,7 +26677,7 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", }, Object { "default": "\\"latest\\"", - "docs": "Tags can be used to provide an alias instead of version numbers.", + "docs": "The npmDistTag to use when publishing from the default branch.", "featured": false, "fullType": Object { "primitive": "string", @@ -26515,7 +26685,7 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", "jsonLike": true, "name": "npmDistTag", "optional": true, - "parent": "NodePackageOptions", + "parent": "ReleaseProjectOptions", "path": Array [ "npmDistTag", ], @@ -27014,6 +27184,23 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", "simpleType": "string", "switch": "projen-version", }, + Object { + "default": "false", + "docs": "Define publishing tasks that can be executed manually as well as workflows.", + "featured": false, + "fullType": Object { + "primitive": "boolean", + }, + "jsonLike": true, + "name": "publishTasks", + "optional": true, + "parent": "ReleaseProjectOptions", + "path": Array [ + "publishTasks", + ], + "simpleType": "boolean", + "switch": "publish-tasks", + }, Object { "default": "true", "docs": "Include a GitHub pull request template.", @@ -28738,7 +28925,7 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", }, Object { "default": "\\"latest\\"", - "docs": "Tags can be used to provide an alias instead of version numbers.", + "docs": "The npmDistTag to use when publishing from the default branch.", "featured": false, "fullType": Object { "primitive": "string", @@ -28746,7 +28933,7 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", "jsonLike": true, "name": "npmDistTag", "optional": true, - "parent": "NodePackageOptions", + "parent": "ReleaseProjectOptions", "path": Array [ "npmDistTag", ], @@ -29245,6 +29432,23 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", "simpleType": "string", "switch": "projen-version", }, + Object { + "default": "false", + "docs": "Define publishing tasks that can be executed manually as well as workflows.", + "featured": false, + "fullType": Object { + "primitive": "boolean", + }, + "jsonLike": true, + "name": "publishTasks", + "optional": true, + "parent": "ReleaseProjectOptions", + "path": Array [ + "publishTasks", + ], + "simpleType": "boolean", + "switch": "publish-tasks", + }, Object { "default": "true", "docs": "Include a GitHub pull request template.", @@ -30947,7 +31151,7 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", }, Object { "default": "\\"latest\\"", - "docs": "Tags can be used to provide an alias instead of version numbers.", + "docs": "The npmDistTag to use when publishing from the default branch.", "featured": false, "fullType": Object { "primitive": "string", @@ -30955,7 +31159,7 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", "jsonLike": true, "name": "npmDistTag", "optional": true, - "parent": "NodePackageOptions", + "parent": "ReleaseProjectOptions", "path": Array [ "npmDistTag", ], @@ -31454,6 +31658,23 @@ be added as both a \`peerDependency\` and a \`devDependency\`.", "simpleType": "string", "switch": "projen-version", }, + Object { + "default": "false", + "docs": "Define publishing tasks that can be executed manually as well as workflows.", + "featured": false, + "fullType": Object { + "primitive": "boolean", + }, + "jsonLike": true, + "name": "publishTasks", + "optional": true, + "parent": "ReleaseProjectOptions", + "path": Array [ + "publishTasks", + ], + "simpleType": "boolean", + "switch": "publish-tasks", + }, Object { "default": "true", "docs": "Include a GitHub pull request template.", diff --git a/test/jsii.test.ts b/test/jsii.test.ts index 5139882c0aa..d9ce3ef6875 100644 --- a/test/jsii.test.ts +++ b/test/jsii.test.ts @@ -53,6 +53,7 @@ describe('maven repository options', () => { mavenArtifactId: 'cdk-watchful', }, defaultReleaseBranch: 'master', + publishTasks: true, }); const outdir = synthSnapshot(project); @@ -67,7 +68,10 @@ describe('maven repository options', () => { 'MAVEN_USERNAME', 'MAVEN_STAGING_PROFILE_ID', ], - steps: [{ exec: 'npx -p jsii-release@latest jsii-release-maven' }], + steps: [ + { exec: 'test "$(git branch --show-current)" = "master"' }, + { exec: 'npx -p jsii-release@latest jsii-release-maven' }, + ], }); const workflow = outdir['.github/workflows/release.yml']; @@ -92,6 +96,7 @@ describe('maven repository options', () => { mavenEndpoint: 'https://s01.oss.sonatype.org', }, defaultReleaseBranch: 'master', + publishTasks: true, }); const outdir = synthSnapshot(project); @@ -109,7 +114,10 @@ describe('maven repository options', () => { 'MAVEN_USERNAME', 'MAVEN_STAGING_PROFILE_ID', ], - steps: [{ exec: 'npx -p jsii-release@latest jsii-release-maven' }], + steps: [ + { exec: 'test "$(git branch --show-current)" = "master"' }, + { exec: 'npx -p jsii-release@latest jsii-release-maven' }, + ], }); const workflow = outdir['.github/workflows/release.yml']; @@ -135,6 +143,7 @@ describe('maven repository options', () => { mavenRepositoryUrl: 'https://maven.pkg.github.com/eladb', }, defaultReleaseBranch: 'master', + publishTasks: true, }); const outdir = synthSnapshot(project); @@ -150,7 +159,10 @@ describe('maven repository options', () => { 'MAVEN_PASSWORD', 'MAVEN_USERNAME', ], - steps: [{ exec: 'npx -p jsii-release@latest jsii-release-maven' }], + steps: [ + { exec: 'test "$(git branch --show-current)" = "master"' }, + { exec: 'npx -p jsii-release@latest jsii-release-maven' }, + ], }); const workflow = outdir['.github/workflows/release.yml']; @@ -176,6 +188,7 @@ describe('maven repository options', () => { mavenRepositoryUrl: 'https://maven.pkg.github.com/eladb', }, defaultReleaseBranch: 'master', + publishTasks: true, })).toThrow('publishing to GitHub Packages requires the "mavenServerId" to be "github"'); }); }); @@ -192,6 +205,7 @@ describe('publish to go', () => { moduleName: 'github.com/foo/bar', }, defaultReleaseBranch: 'master', + publishTasks: true, }); const output = synthSnapshot(project); @@ -213,6 +227,7 @@ describe('publish to go', () => { author: 'My Name', name: 'testproject', defaultReleaseBranch: 'main', + publishTasks: true, }); const output = synthSnapshot(project); @@ -228,6 +243,7 @@ describe('publish to go', () => { name: 'testproject', defaultReleaseBranch: 'main', releaseToNpm: true, + publishTasks: true, }); const output = synthSnapshot(project); @@ -243,6 +259,7 @@ describe('publish to go', () => { name: 'testproject', defaultReleaseBranch: 'main', releaseToNpm: false, + publishTasks: true, }); const output = synthSnapshot(project); @@ -285,6 +302,7 @@ test('docgen: true should just work', () => { defaultReleaseBranch: 'main', repositoryUrl: 'https://github.com/foo/bar.git', docgen: true, + publishTasks: true, }); const output = synthSnapshot(project); diff --git a/test/node-project.test.ts b/test/node-project.test.ts index 1b09d35dad1..98ba8cfeafe 100644 --- a/test/node-project.test.ts +++ b/test/node-project.test.ts @@ -345,7 +345,6 @@ describe('npm publishing options', () => { // THEN expect(npm.npmAccess).toStrictEqual(NpmAccess.PUBLIC); - expect(npm.npmDistTag).toStrictEqual('latest'); expect(npm.npmRegistry).toStrictEqual('registry.npmjs.org'); expect(npm.npmRegistryUrl).toStrictEqual('https://registry.npmjs.org/'); expect(npm.npmTokenSecret).toStrictEqual('NPM_TOKEN'); @@ -388,14 +387,12 @@ describe('npm publishing options', () => { // WHEN const npm = new NodePackage(project, { packageName: 'scoped@my-package', - npmDistTag: 'next', npmRegistryUrl: 'https://foo.bar', npmAccess: NpmAccess.PUBLIC, npmTokenSecret: 'GITHUB_TOKEN', }); // THEN - expect(npm.npmDistTag).toStrictEqual('next'); expect(npm.npmRegistry).toStrictEqual('foo.bar'); expect(npm.npmRegistryUrl).toStrictEqual('https://foo.bar/'); expect(npm.npmAccess).toStrictEqual(NpmAccess.PUBLIC); @@ -403,7 +400,6 @@ describe('npm publishing options', () => { expect(packageJson(project).publishConfig).toStrictEqual({ access: 'public', registry: 'https://foo.bar/', - tag: 'next', }); }); diff --git a/test/release/__snapshots__/release.test.ts.snap b/test/release/__snapshots__/release.test.ts.snap index 31eeb78d06c..f47448d659f 100644 --- a/test/release/__snapshots__/release.test.ts.snap +++ b/test/release/__snapshots__/release.test.ts.snap @@ -118,6 +118,7 @@ jobs: - name: Release run: npx -p jsii-release@latest jsii-release-npm env: + NPM_DIST_TAG: latest NPM_REGISTRY: my-domain-111122223333.d.codeartifact.us-west-2.amazonaws.com/npm/my_repo/ AWS_ACCESS_KEY_ID: \${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: \${{ secrets.AWS_SECRET_ACCESS_KEY }} @@ -240,6 +241,9 @@ node_modules/ "GITHUB_REF", ], "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"main\\"", + }, Object { "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \\"Release.tag_name already exists\\" $errout; then cat $errout; exit $exitcode; fi", }, @@ -248,6 +252,7 @@ node_modules/ "publish:npm": Object { "description": "Publish this package to npm", "env": Object { + "NPM_DIST_TAG": "latest", "NPM_REGISTRY": "my-domain-111122223333.d.codeartifact.us-west-2.amazonaws.com/npm/my_repo/", }, "name": "publish:npm", @@ -256,6 +261,9 @@ node_modules/ "AWS_SECRET_ACCESS_KEY", ], "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"main\\"", + }, Object { "exec": "npx -p jsii-release@latest jsii-release-npm", }, @@ -428,6 +436,7 @@ jobs: - name: Release run: npx -p jsii-release@latest jsii-release-npm env: + NPM_DIST_TAG: latest NPM_REGISTRY: my-domain-111122223333.d.codeartifact.us-west-2.amazonaws.com/npm/my_repo/ AWS_ACCESS_KEY_ID: \${{ secrets.OTHER_AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: \${{ secrets.OTHER_AWS_SECRET_ACCESS_KEY }} @@ -550,6 +559,9 @@ node_modules/ "GITHUB_REF", ], "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"main\\"", + }, Object { "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \\"Release.tag_name already exists\\" $errout; then cat $errout; exit $exitcode; fi", }, @@ -558,6 +570,7 @@ node_modules/ "publish:npm": Object { "description": "Publish this package to npm", "env": Object { + "NPM_DIST_TAG": "latest", "NPM_REGISTRY": "my-domain-111122223333.d.codeartifact.us-west-2.amazonaws.com/npm/my_repo/", }, "name": "publish:npm", @@ -566,6 +579,9 @@ node_modules/ "AWS_SECRET_ACCESS_KEY", ], "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"main\\"", + }, Object { "exec": "npx -p jsii-release@latest jsii-release-npm", }, @@ -738,6 +754,7 @@ jobs: - name: Release run: npx -p jsii-release@latest jsii-release-npm env: + NPM_DIST_TAG: latest NPM_REGISTRY: my-domain-111122223333.d.codeartifact.us-west-2.amazonaws.com/npm/my_repo/ AWS_ACCESS_KEY_ID: \${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: \${{ secrets.AWS_SECRET_ACCESS_KEY }} @@ -861,6 +878,9 @@ node_modules/ "GITHUB_REF", ], "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"main\\"", + }, Object { "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \\"Release.tag_name already exists\\" $errout; then cat $errout; exit $exitcode; fi", }, @@ -869,6 +889,7 @@ node_modules/ "publish:npm": Object { "description": "Publish this package to npm", "env": Object { + "NPM_DIST_TAG": "latest", "NPM_REGISTRY": "my-domain-111122223333.d.codeartifact.us-west-2.amazonaws.com/npm/my_repo/", }, "name": "publish:npm", @@ -878,6 +899,9 @@ node_modules/ "AWS_ROLE_TO_ASSUME", ], "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"main\\"", + }, Object { "exec": "npx -p jsii-release@latest jsii-release-npm", }, @@ -1279,6 +1303,43 @@ node_modules/ "GITHUB_REF", ], "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"main\\"", + }, + Object { + "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \\"Release.tag_name already exists\\" $errout; then cat $errout; exit $exitcode; fi", + }, + ], + }, + "publish:github:10.x": Object { + "description": "Publish this package to GitHub Releases", + "name": "publish:github:10.x", + "requiredEnv": Array [ + "GITHUB_TOKEN", + "GITHUB_REPOSITORY", + "GITHUB_REF", + ], + "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"10.x\\"", + }, + Object { + "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \\"Release.tag_name already exists\\" $errout; then cat $errout; exit $exitcode; fi", + }, + ], + }, + "publish:github:2.x": Object { + "description": "Publish this package to GitHub Releases", + "name": "publish:github:2.x", + "requiredEnv": Array [ + "GITHUB_TOKEN", + "GITHUB_REPOSITORY", + "GITHUB_REF", + ], + "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"2.x\\"", + }, Object { "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \\"Release.tag_name already exists\\" $errout; then cat $errout; exit $exitcode; fi", }, @@ -1717,6 +1778,26 @@ node_modules/ "GITHUB_REF", ], "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"main\\"", + }, + Object { + "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \\"Release.tag_name already exists\\" $errout; then cat $errout; exit $exitcode; fi", + }, + ], + }, + "publish:github:foo": Object { + "description": "Publish this package to GitHub Releases", + "name": "publish:github:foo", + "requiredEnv": Array [ + "GITHUB_TOKEN", + "GITHUB_REPOSITORY", + "GITHUB_REF", + ], + "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"foo\\"", + }, Object { "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \\"Release.tag_name already exists\\" $errout; then cat $errout; exit $exitcode; fi", }, @@ -1730,6 +1811,25 @@ node_modules/ "TWINE_PASSWORD", ], "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"main\\"", + }, + Object { + "exec": "npx -p jsii-release@latest jsii-release-pypi", + }, + ], + }, + "publish:pypi:foo": Object { + "description": "Publish this package to PyPI", + "name": "publish:pypi:foo", + "requiredEnv": Array [ + "TWINE_USERNAME", + "TWINE_PASSWORD", + ], + "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"foo\\"", + }, Object { "exec": "npx -p jsii-release@latest jsii-release-pypi", }, @@ -2032,6 +2132,9 @@ node_modules/ "GITHUB_REF", ], "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"main\\"", + }, Object { "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \\"Release.tag_name already exists\\" $errout; then cat $errout; exit $exitcode; fi", }, @@ -2182,6 +2285,7 @@ jobs: - name: Release run: npx -p jsii-release@latest jsii-release-npm env: + NPM_DIST_TAG: latest NPM_REGISTRY: npm.pkg.github.com NPM_TOKEN: \${{ secrets.GITHUB_TOKEN }} - name: Extract Version @@ -2322,6 +2426,7 @@ jobs: - name: Release run: npx -p jsii-release@latest jsii-release-npm env: + NPM_DIST_TAG: latest NPM_REGISTRY: npm.pkg.github.com NPM_TOKEN: \${{ secrets.GITHUB_TOKEN }} container: @@ -2443,6 +2548,9 @@ node_modules/ "GITHUB_REF", ], "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"main\\"", + }, Object { "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \\"Release.tag_name already exists\\" $errout; then cat $errout; exit $exitcode; fi", }, @@ -2451,6 +2559,7 @@ node_modules/ "publish:npm": Object { "description": "Publish this package to npm", "env": Object { + "NPM_DIST_TAG": "latest", "NPM_REGISTRY": "npm.pkg.github.com", }, "name": "publish:npm", @@ -2458,6 +2567,9 @@ node_modules/ "NPM_TOKEN", ], "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"main\\"", + }, Object { "exec": "npx -p jsii-release@latest jsii-release-npm", }, @@ -2650,6 +2762,9 @@ Object { "GITHUB_REF", ], "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"main\\"", + }, Object { "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \\"Release.tag_name already exists\\" $errout; then cat $errout; exit $exitcode; fi", }, @@ -2922,6 +3037,9 @@ node_modules/ "GITHUB_REF", ], "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"main\\"", + }, Object { "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \\"Release.tag_name already exists\\" $errout; then cat $errout; exit $exitcode; fi", }, @@ -3116,6 +3234,26 @@ Object { "GITHUB_REF", ], "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"main\\"", + }, + Object { + "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \\"Release.tag_name already exists\\" $errout; then cat $errout; exit $exitcode; fi", + }, + ], + }, + "publish:github:10.x": Object { + "description": "Publish this package to GitHub Releases", + "name": "publish:github:10.x", + "requiredEnv": Array [ + "GITHUB_TOKEN", + "GITHUB_REPOSITORY", + "GITHUB_REF", + ], + "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"10.x\\"", + }, Object { "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \\"Release.tag_name already exists\\" $errout; then cat $errout; exit $exitcode; fi", }, @@ -3317,6 +3455,7 @@ jobs: - name: Release run: npx -p jsii-release@latest jsii-release-npm env: + NPM_DIST_TAG: latest NPM_TOKEN: \${{ secrets.NPM_TOKEN }} container: image: jsii/superchain:1-buster-slim-node14 @@ -3435,6 +3574,9 @@ Object { "GITHUB_REF", ], "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"main\\"", + }, Object { "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \\"Release.tag_name already exists\\" $errout; then cat $errout; exit $exitcode; fi", }, @@ -3451,6 +3593,9 @@ Object { "GITHUB_TOKEN", ], "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"main\\"", + }, Object { "exec": "npx -p jsii-release@latest jsii-release-golang", }, @@ -3467,6 +3612,9 @@ Object { "MAVEN_STAGING_PROFILE_ID", ], "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"main\\"", + }, Object { "exec": "npx -p jsii-release@latest jsii-release-maven", }, @@ -3474,11 +3622,17 @@ Object { }, "publish:npm": Object { "description": "Publish this package to npm", + "env": Object { + "NPM_DIST_TAG": "latest", + }, "name": "publish:npm", "requiredEnv": Array [ "NPM_TOKEN", ], "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"main\\"", + }, Object { "exec": "npx -p jsii-release@latest jsii-release-npm", }, @@ -3491,6 +3645,9 @@ Object { "NUGET_API_KEY", ], "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"main\\"", + }, Object { "exec": "npx -p jsii-release@latest jsii-release-nuget", }, @@ -3504,6 +3661,9 @@ Object { "TWINE_PASSWORD", ], "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"main\\"", + }, Object { "exec": "npx -p jsii-release@latest jsii-release-pypi", }, @@ -3830,15 +3990,35 @@ node_modules/ "description": "Prepare the project for compilation", "name": "pre-compile", }, - "publish:github": Object { + "publish:github:firefox": Object { "description": "Publish this package to GitHub Releases", - "name": "publish:github", + "name": "publish:github:firefox", + "requiredEnv": Array [ + "GITHUB_TOKEN", + "GITHUB_REPOSITORY", + "GITHUB_REF", + ], + "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"firefox\\"", + }, + Object { + "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \\"Release.tag_name already exists\\" $errout; then cat $errout; exit $exitcode; fi", + }, + ], + }, + "publish:github:safari": Object { + "description": "Publish this package to GitHub Releases", + "name": "publish:github:safari", "requiredEnv": Array [ "GITHUB_TOKEN", "GITHUB_REPOSITORY", "GITHUB_REF", ], "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"safari\\"", + }, Object { "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \\"Release.tag_name already exists\\" $errout; then cat $errout; exit $exitcode; fi", }, @@ -4268,6 +4448,43 @@ node_modules/ "GITHUB_REF", ], "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"main\\"", + }, + Object { + "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \\"Release.tag_name already exists\\" $errout; then cat $errout; exit $exitcode; fi", + }, + ], + }, + "publish:github:3.x": Object { + "description": "Publish this package to GitHub Releases", + "name": "publish:github:3.x", + "requiredEnv": Array [ + "GITHUB_TOKEN", + "GITHUB_REPOSITORY", + "GITHUB_REF", + ], + "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"3.x\\"", + }, + Object { + "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \\"Release.tag_name already exists\\" $errout; then cat $errout; exit $exitcode; fi", + }, + ], + }, + "publish:github:next": Object { + "description": "Publish this package to GitHub Releases", + "name": "publish:github:next", + "requiredEnv": Array [ + "GITHUB_TOKEN", + "GITHUB_REPOSITORY", + "GITHUB_REF", + ], + "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"next\\"", + }, Object { "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \\"Release.tag_name already exists\\" $errout; then cat $errout; exit $exitcode; fi", }, @@ -4584,15 +4801,18 @@ node_modules/ "description": "Prepare the project for compilation", "name": "pre-compile", }, - "publish:github": Object { + "publish:github:10.x": Object { "description": "Publish this package to GitHub Releases", - "name": "publish:github", + "name": "publish:github:10.x", "requiredEnv": Array [ "GITHUB_TOKEN", "GITHUB_REPOSITORY", "GITHUB_REF", ], "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"10.x\\"", + }, Object { "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \\"Release.tag_name already exists\\" $errout; then cat $errout; exit $exitcode; fi", }, @@ -4858,15 +5078,18 @@ node_modules/ "description": "Prepare the project for compilation", "name": "pre-compile", }, - "publish:github": Object { + "publish:github:10.x": Object { "description": "Publish this package to GitHub Releases", - "name": "publish:github", + "name": "publish:github:10.x", "requiredEnv": Array [ "GITHUB_TOKEN", "GITHUB_REPOSITORY", "GITHUB_REF", ], "steps": Array [ + Object { + "exec": "test \\"$(git branch --show-current)\\" = \\"10.x\\"", + }, Object { "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \\"Release.tag_name already exists\\" $errout; then cat $errout; exit $exitcode; fi", }, diff --git a/test/release/release.test.ts b/test/release/release.test.ts index ee6f0d69cac..b054affeff5 100644 --- a/test/release/release.test.ts +++ b/test/release/release.test.ts @@ -12,6 +12,7 @@ test('minimal', () => { task: project.buildTask, versionFile: 'version.json', branch: 'main', + publishTasks: true, // to increase coverage }); const outdir = synthSnapshot(project); @@ -29,6 +30,7 @@ test('with major version filter', () => { branch: '10.x', majorVersion: 10, releaseWorkflowName: 'release', + publishTasks: true, // to increase coverage }); // THEN @@ -49,6 +51,7 @@ test('with release tag prefix', () => { majorVersion: 10, releaseTagPrefix: 'prefix/', releaseWorkflowName: 'release', + publishTasks: true, // to increase coverage }); // THEN @@ -66,6 +69,7 @@ test('addBranch() can be used for additional release branches', () => { versionFile: 'version.json', branch: 'main', majorVersion: 1, + publishTasks: true, // to increase coverage }); // WHEN @@ -88,6 +92,7 @@ test('if multiple branches are defined, the default branch requires a "majorVers task: project.buildTask, versionFile: 'version.json', branch: 'main', + publishTasks: true, // to increase coverage }); // WHEN @@ -105,6 +110,7 @@ test('publisher (defaults)', () => { task: project.buildTask, versionFile: 'version.json', branch: 'main', + publishTasks: true, }); // WHEN @@ -129,6 +135,7 @@ test('publishers are added as jobs to all release workflows', () => { versionFile: 'version.json', branch: 'main', majorVersion: 1, + publishTasks: true, // to increase coverage }); // WHEN @@ -171,6 +178,7 @@ test('manual releases do not generate a release workflow', () => { versionFile: 'version.json', branch: 'main', releaseTrigger: ReleaseTrigger.manual(), + publishTasks: true, // to increase coverage }); // THEN @@ -190,6 +198,7 @@ test('releaseSchedule schedules releases', () => { branch: 'main', releaseEveryCommit: false, releaseSchedule: schedule, + publishTasks: true, // to increase coverage }); // THEN @@ -211,6 +220,7 @@ test('addJobs() can be used to add arbitrary jobs to the release workflows', () versionFile: 'version.json', branch: 'main', majorVersion: 0, + publishTasks: true, // to increase coverage }); release.addBranch('foo', { majorVersion: 4, workflowName: 'foo-workflow' }); @@ -242,6 +252,7 @@ test('majorVersion can be 0', () => { versionFile: 'goo.json', branch: 'main', majorVersion: 0, + publishTasks: true, // to increase coverage }); // THEN @@ -260,6 +271,7 @@ test('prerelease can be specified per branch', () => { versionFile: 'goo.json', branch: 'main', majorVersion: 0, + publishTasks: true, // to increase coverage }); release.addBranch('10.x', { majorVersion: 10, prerelease: 'pre' }); @@ -285,6 +297,7 @@ test('releaseBranches can be use to define additional branches', () => { '3.x': { majorVersion: 3 }, 'next': { majorVersion: 4, prerelease: 'pre' }, }, + publishTasks: true, // to increase coverage }); const outdir = synthSnapshot(project); @@ -306,6 +319,7 @@ test('releaseBranches can be defined with different tag prefixes to the same maj releaseBranches: { safari: { majorVersion: 1, tagPrefix: 'safari/' }, }, + publishTasks: true, // to increase coverage }); const outdir = synthSnapshot(project); @@ -334,6 +348,7 @@ test('github packages are supported by npm', () => { task: project.buildTask, versionFile: 'version.json', branch: 'main', + publishTasks: true, // to increase coverage }); // WHEN @@ -356,6 +371,7 @@ test('can enable issue creation on failed releases with a custom label', () => { branch: 'main', releaseFailureIssue: true, releaseFailureIssueLabel: 'custom-label', + publishTasks: true, // to increase coverage }); // WHEN @@ -375,6 +391,7 @@ test('AWS CodeArtifact is supported by npm', () => { task: project.buildTask, versionFile: 'version.json', branch: 'main', + publishTasks: true, // to increase coverage }); // WHEN @@ -395,6 +412,7 @@ test('AWS CodeArtifact is supported by npm with AWS access keys', () => { task: project.buildTask, versionFile: 'version.json', branch: 'main', + publishTasks: true, // to increase coverage }); // WHEN @@ -420,6 +438,7 @@ test('AWS CodeArtifact is supported with role to assume', () => { task: project.buildTask, versionFile: 'version.json', branch: 'main', + publishTasks: true, // to increase coverage }); // WHEN @@ -442,6 +461,7 @@ test('can be modified with escape hatches', () => { task: project.buildTask, versionFile: 'version.json', branch: 'main', + publishTasks: true, // to increase coverage }); // WHEN @@ -463,6 +483,7 @@ test('manual release with custom git-push', () => { versionFile: 'version.json', branch: 'main', releaseTrigger: ReleaseTrigger.manual({ gitPushCommand: 'git push --follow-tags -o ci.skip origin main' }), + publishTasks: true, // to increase coverage }); // THEN @@ -484,6 +505,7 @@ test('publisher can use custom github runner', () => { versionFile: 'version.json', branch: 'main', workflowRunsOn: ['self-hosted'], + publishTasks: true, // to increase coverage }); // WHEN @@ -500,3 +522,117 @@ test('publisher can use custom github runner', () => { expect(workflow.jobs[job]['runs-on']).toEqual('self-hosted'); } }); + +describe('npmDistTag', () => { + test('determines npm dist-tag used in the workflow', () => { + // GIVEN + const project = new TestProject(); + + // WHEN + const release = new Release(project, { + releaseBranches: { + 'main-3': { majorVersion: 3, npmDistTag: 'latest-3' }, + }, + branch: 'main', + majorVersion: 1, + task: project.buildTask, + versionFile: 'version.json', + publishTasks: true, // to increase coverage + }); + + release.publisher.publishToNpm(); + + // THEN + const files = synthSnapshot(project); + const main = YAML.parse(files['.github/workflows/release.yml']); + const main3 = YAML.parse(files['.github/workflows/release-main-3.yml']); + expect(main.jobs.release_npm.steps[1].env).toStrictEqual({ + NPM_DIST_TAG: 'latest', + NPM_TOKEN: '${{ secrets.NPM_TOKEN }}', + }); + expect(main3.jobs.release_npm.steps[1].env).toStrictEqual({ + NPM_TOKEN: '${{ secrets.NPM_TOKEN }}', + NPM_DIST_TAG: 'latest-3', + }); + }); + + test('the dist-tag for the default branch is set at the root', () => { + // GIVEN + const project = new TestProject(); + + // WHEN + const release = new Release(project, { + releaseBranches: { + 'main-3': { majorVersion: 3, npmDistTag: 'latest-3' }, + }, + branch: 'main', + majorVersion: 1, + npmDistTag: 'main-tag', + task: project.buildTask, + versionFile: 'version.json', + publishTasks: true, // to increase coverage + }); + + release.publisher.publishToNpm(); + + // THEN + const files = synthSnapshot(project); + const main = YAML.parse(files['.github/workflows/release.yml']); + const main3 = YAML.parse(files['.github/workflows/release-main-3.yml']); + expect(main.jobs.release_npm.steps[1].env).toStrictEqual({ + NPM_TOKEN: '${{ secrets.NPM_TOKEN }}', + NPM_DIST_TAG: 'main-tag', + }); + expect(main3.jobs.release_npm.steps[1].env).toStrictEqual({ + NPM_TOKEN: '${{ secrets.NPM_TOKEN }}', + NPM_DIST_TAG: 'latest-3', + }); + + + }); + + test('if branch-level dist-tag is set, then publishToNpm cannot specify dist-tag', () => { + // GIVEN + const project = new TestProject(); + + // WHEN + const release = new Release(project, { + releaseBranches: { + 'main-3': { majorVersion: 3, npmDistTag: 'latest-3' }, + }, + branch: 'main', + majorVersion: 1, + task: project.buildTask, + versionFile: 'version.json', + publishTasks: true, // to increase coverage + }); + + release.publisher.publishToNpm({ distTag: 'next' }); + + expect(() => project.synth()).toThrow(/cannot set branch-level npmDistTag and npmDistTag in publishToNpm/); + }); +}); + +test('if publishTasks is disabled, no publish tasks are created', () => { + // GIVEN + const project = new TestProject(); + + const release = new Release(project, { + task: project.buildTask, + versionFile: 'version.json', + branch: 'main', + workflowRunsOn: ['self-hosted'], + }); + + // WHEN + release.publisher.publishToGo(); + release.publisher.publishToMaven(); + release.publisher.publishToNpm(); + release.publisher.publishToNuget(); + release.publisher.publishToPyPi(); + + // THEN + const files = synthSnapshot(project); + const tasks = files['.projen/tasks.json'].tasks; + expect(Object.keys(tasks).filter(t => t.startsWith('publish:')).length).toBe(0); +}); \ No newline at end of file diff --git a/test/web/__snapshots__/nextjs-project.test.ts.snap b/test/web/__snapshots__/nextjs-project.test.ts.snap index 4cb5c3ddd8a..aa4d331cf98 100644 --- a/test/web/__snapshots__/nextjs-project.test.ts.snap +++ b/test/web/__snapshots__/nextjs-project.test.ts.snap @@ -533,20 +533,6 @@ pull_request_rules: "description": "Prepare the project for compilation", "name": "pre-compile", }, - "publish:github": Object { - "description": "Publish this package to GitHub Releases", - "name": "publish:github", - "requiredEnv": Array [ - "GITHUB_TOKEN", - "GITHUB_REPOSITORY", - "GITHUB_REF", - ], - "steps": Array [ - Object { - "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \\"Release.tag_name already exists\\" $errout; then cat $errout; exit $exitcode; fi", - }, - ], - }, "release": Object { "description": "Prepare a release from \\"main\\" branch", "env": Object { @@ -920,7 +906,6 @@ pull_request_rules: "post-compile": "npx projen post-compile", "pre-compile": "npx projen pre-compile", "projen": "npx projen", - "publish:github": "npx projen publish:github", "release": "npx projen release", "server": "npx projen server", "telemetry": "npx projen telemetry", diff --git a/test/web/__snapshots__/react-project.test.ts.snap b/test/web/__snapshots__/react-project.test.ts.snap index 220274afa05..65c4ae01483 100644 --- a/test/web/__snapshots__/react-project.test.ts.snap +++ b/test/web/__snapshots__/react-project.test.ts.snap @@ -520,20 +520,6 @@ pull_request_rules: "description": "Prepare the project for compilation", "name": "pre-compile", }, - "publish:github": Object { - "description": "Publish this package to GitHub Releases", - "name": "publish:github", - "requiredEnv": Array [ - "GITHUB_TOKEN", - "GITHUB_REPOSITORY", - "GITHUB_REF", - ], - "steps": Array [ - Object { - "exec": "errout=$(mktemp); gh release create $(cat dist/releasetag.txt) -R $GITHUB_REPOSITORY -F dist/changelog.md -t $(cat dist/releasetag.txt) --target $GITHUB_REF 2> $errout && true; exitcode=$?; if [ $exitcode -ne 0 ] && ! grep -q \\"Release.tag_name already exists\\" $errout; then cat $errout; exit $exitcode; fi", - }, - ], - }, "release": Object { "description": "Prepare a release from \\"main\\" branch", "env": Object { @@ -904,7 +890,6 @@ pull_request_rules: "post-compile": "npx projen post-compile", "pre-compile": "npx projen pre-compile", "projen": "npx projen", - "publish:github": "npx projen publish:github", "release": "npx projen release", "test": "npx projen test", "unbump": "npx projen unbump",