Skip to content

Commit

Permalink
Merge pull request #50 from livingdocsIO/branches-support
Browse files Browse the repository at this point in the history
Add support for `release.branches` in package.json
  • Loading branch information
JordiVM committed Jul 11, 2024
2 parents 00fede2 + 9678746 commit 83da925
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/shell/sh-is-release-branch-creation-allowed.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = function (dep) {
----------------------------------------------
Workflow for a Bump PR / Create Release Branch
----------------------------------------------
1) Execute npx @livingdocsIO/create-bump-pr (see example and option description)
1) Execute npx github:livingdocsIO/create-bump-pr (see example and option description)
- the script automatically updates the README.md with an empty line to indicate a change
- the script create a PR to incite a new minor version
2) Go to github and merge the PR
Expand Down
12 changes: 10 additions & 2 deletions lib/shell/sh-update-package.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,21 @@
module.exports = function (dep) {
const { exec, logBgYellow, logYellow } = dep
return function (argv) {
let propertyName
logBgYellow('Update package.json with semantic-release information')
// const releaseTag = exec(`echo release-$(echo ${argv.baseTag} | cut -d '.' -f1 -f2).x`)
// eslint-disable-next-line no-extra-boolean-cast
const result = exec(`jq '.release.branches != null' package.json`)
if (result.stdout) {
propertyName = 'release.branch'
} else {
propertyName = 'release.branches[0].name'
}
exec(`cat package.json \
| jq ".release.branch=\\"${argv.releaseBranchName}\\" \
| jq ".${propertyName}=\\"${argv.releaseBranchName}\\" \
| .publishConfig.tag=\\"${argv.releaseBranchName}\\"" \
| cat > package.json.tmp && mv package.json.tmp package.json`
)
logYellow('package.json updated')
logYellow(`Updated ${propertyName} in package.json`)
}
}

0 comments on commit 83da925

Please sign in to comment.