Skip to content

Commit

Permalink
feat(manifest): add oprion to skip creating github release
Browse files Browse the repository at this point in the history
  • Loading branch information
rabraghib committed Sep 12, 2021
1 parent 66cecda commit 54b7c52
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
5 changes: 4 additions & 1 deletion docs/manifest-releaser.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ documented in comments)
// absence defaults to [] (i.e. no plugins)
"plugins": ["node-workspace", "cargo-workspace"],

// optional top-level defaults that can be overriden per package:
// optional top-level defaults that can be overridden per package:

// set default package release-type to "python"
// absence defaults to "node"
Expand Down Expand Up @@ -153,6 +153,9 @@ documented in comments)
// absence defaults to false and Releases are created as already Published.
"draft": true

// Skip creating GitHub Releases
// absence defaults to false and Releases will be created
"skip-github-release": true,

// per package configuration: at least one entry required.
// the key is the relative path from the repo root to the folder that contains
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ interface GitHubOptions {
export interface GitHubReleaseOptions {
releaseLabel?: string;
draft?: boolean;
skipGithubRelease?: boolean;
}

// Used by ReleasePR: Factory and Constructor
Expand Down Expand Up @@ -101,6 +102,7 @@ export type ManifestPackage = Pick<
| 'releaseAs'
| 'changelogSections'
| 'changelogPath'
| 'skipGithubRelease'
> & {
// these items are not optional in the manifest context.
path: string;
Expand Down
25 changes: 16 additions & 9 deletions src/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ interface ReleaserConfigJson {
'bump-patch-for-minor-pre-major'?: boolean;
'changelog-sections'?: ChangelogSection[];
'release-as'?: string;
'skip-github-release'?: boolean;
draft?: boolean;
}

Expand Down Expand Up @@ -240,6 +241,10 @@ export class Manifest {
config['release-as']
),
draft: pkgCfg['draft'] ?? config['draft'],
skipGithubRelease:
pkgCfg['skip-github-release'] ??
config['skip-github-release'] ??
false,
};
packages.push(pkg);
}
Expand Down Expand Up @@ -676,15 +681,17 @@ export class Manifest {
);
return;
}
const packagesForReleasers = await this.getPackagesToRelease(
// use the lastMergedPR.sha as a Commit: lastMergedPR.files will inform
// getPackagesToRelease() what packages had changes (i.e. at least one
// file under their path changed in the lastMergedPR such as
// "packages/mypkg/package.json"). These are exactly the packages we want
// to create releases/tags for.
[{sha: lastMergedPR.sha, message: '', files: lastMergedPR.files}],
lastMergedPR.sha
);
const packagesForReleasers = (
await this.getPackagesToRelease(
// use the lastMergedPR.sha as a Commit: lastMergedPR.files will inform
// getPackagesToRelease() what packages had changes (i.e. at least one
// file under their path changed in the lastMergedPR such as
// "packages/mypkg/package.json"). These are exactly the packages we want
// to create releases/tags for.
[{sha: lastMergedPR.sha, message: '', files: lastMergedPR.files}],
lastMergedPR.sha
)
).filter(pkg => !pkg.config.skipGithubRelease);
const releases: Record<string, GitHubReleaseResponse | undefined> = {};
let allReleasesCreated = !!packagesForReleasers.length;
for (const pkg of packagesForReleasers) {
Expand Down

0 comments on commit 54b7c52

Please sign in to comment.