Skip to content

Commit

Permalink
feat: release all flag
Browse files Browse the repository at this point in the history
  • Loading branch information
jprosevear committed May 23, 2024
1 parent fab1d85 commit 7c6a117
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
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
}

0 comments on commit 7c6a117

Please sign in to comment.