Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release all flag #68

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions src/publish/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,15 @@ import {
* @returns {Promise<void>}
*/
export const publish = async (options) => {
const { branchConfigs, packages, rootDir, branch, tag, ghToken } = options
const {
branchConfigs,
packages,
rootDir,
branch,
tag,
ghToken,
releaseAll = false,
} = options

const branchName = /** @type {string} */ (branch ?? currentGitBranch())
const isMainBranch = branchName === 'main'
Expand Down Expand Up @@ -65,9 +73,13 @@ export const publish = async (options) => {
let range = `${latestTag}..HEAD`
// let range = ``;

// If RELEASE_ALL is set via a commit subject or body, all packages will be
// released regardless if they have changed files matching the package srcDir.
let RELEASE_ALL = false
// All packages will be released if any of the following conditions are met:
// - RELEASE_ALL is set via a commit subject or body
// - A tag is explicitly set
// - The config option releaseAll is set to true
//
// Otherwise, only packages with changed files matching the package srcDir will be released.
let RELEASE_ALL = releaseAll

if (!latestTag || tag) {
if (tag) {
Expand Down
2 changes: 2 additions & 0 deletions src/publish/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,6 @@ export type RunOptions = {
tag?: string
// The GitHub token used to search for user metadata and make a GitHub release.
ghToken?: string
/** Release all packages. Defaults to false but can be overridden with RELEASE_ALL in a commit message */
releaseAll?: boolean
}