Skip to content
Merged
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
18 changes: 18 additions & 0 deletions packages/sui-mono/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,24 @@ If you want the `package-lock.json` to be committed once the packages are releas
sui-mono release --lock
```

To append `[skip ci]` to release commit messages (skips CI pipeline for the release commits):

```sh
sui-mono release --skip-ci
```

To append a `skip-checks: true` trailer to release commit messages (skips GitHub branch protection check runs):

```sh
sui-mono release --skip-checks
```

Both flags can be combined:

```sh
sui-mono release --skip-ci --skip-checks
```

## How to configure your project

First you need to install the `@s-ui/mono` package in your project
Expand Down
13 changes: 8 additions & 5 deletions packages/sui-mono/bin/sui-mono-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ program
.option('-E, --github-email <email>', 'github email')
.option('-L, --lock', 'Commit lock file', false)
.option('--skip-ci', 'Add [skip ci] to release commit message', false)
.option('--skip-checks', 'Add skip-checks: true trailer to release commit message', false)
.on('--help', () => {
console.log(' Description:')
console.log('')
Expand All @@ -39,7 +40,7 @@ program
})
.parse(process.argv)

const {scope: packageScope, githubEmail, githubToken, githubUser, lock, skipCi} = program.opts()
const {scope: packageScope, githubEmail, githubToken, githubUser, lock, skipCi, skipChecks} = program.opts()

const BASE_DIR = process.cwd()

Expand Down Expand Up @@ -69,7 +70,7 @@ const getCwd = ({pkg}) => {
return isMonoPackage ? BASE_DIR : path.join(process.cwd(), pkg)
}

const commit = async ({pkg, code, skipCi}) => {
const commit = async ({pkg, code, skipCi, skipChecks}) => {
const isMonoPackage = checkIsMonoPackage()
const cwd = getCwd({pkg})

Expand All @@ -84,8 +85,10 @@ const commit = async ({pkg, code, skipCi}) => {
// Add [skip ci] to the commit message to avoid CI build
// https://docs.travis-ci.com/user/customizing-the-build/#skipping-a-build
const skipCiSuffix = skipCi ? ' [skip ci]' : ''
const commitMsg = `release(${packageScope}): v${version}${skipCiSuffix}`
await exec(`git commit -m "${commitMsg}"`, {cwd})
const skipChecksSuffix = skipChecks ? '\n\n\nskip-checks: true' : ''
const commitMsg = `release(${packageScope}): v${version}${skipCiSuffix}${skipChecksSuffix}`
const cleanupFlag = skipChecks ? ' --cleanup=verbatim' : ''
await exec(`git commit -m "${commitMsg}"${cleanupFlag}`, {cwd})

await exec(`${suiMonoBinPath} changelog ${cwd}`)
await exec(`git add ${path.join(cwd, changelogFilename)}`, {cwd})
Expand Down Expand Up @@ -163,7 +166,7 @@ checkShouldRelease()
const packagesToRelease = releasesByPackages({status}).filter(({code}) => code !== 0)

for (const pkg of packagesToRelease) {
await commit({...pkg, skipCi})
await commit({...pkg, skipCi, skipChecks})
}

if (packagesToRelease.length > 0) {
Expand Down
Loading