Skip to content

Commit 13a1345

Browse files
committed
feat(ci): add cli option to enable running of CI on release or snapshot commits
Fixes #20
2 parents c8f9ac0 + e85237f commit 13a1345

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,13 @@ after_success:
8585
- semantic-release --prepare @conveyal/maven-semantic-release --publish @semantic-release/github,@conveyal/maven-semantic-release --verify-conditions @semantic-release/github,@conveyal/maven-semantic-release --verify-release @conveyal/maven-semantic-release --use-conveyal-workflow --dev-branch=dev --skip-maven-deploy
8686
```
8787

88+
By default the commit message contains the appendix '[ci skip]' that skips the pipeline to run when the pom.xml is pushed. This can be disabled for snapshot and final versions if needed by providing the flag `disable-snapshot-skip-ci` or `disable-final-skip-ci`. For example:
89+
90+
```
91+
after_success:
92+
- semantic-release --prepare @conveyal/maven-semantic-release --publish @semantic-release/github,@conveyal/maven-semantic-release --verify-conditions @semantic-release/github,@conveyal/maven-semantic-release --verify-release @conveyal/maven-semantic-release --use-conveyal-workflow --dev-branch=dev --disable-snapshot-skip-ci --disable-final-skip-ci
93+
```
94+
8895
#### before_install
8996

9097
Be sure to include the import of your signing keys. If you followed everything correctly in step 4 you should have something like the following added to your .travis.yml file:

lib/git.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,19 @@ async function saveChangesToPomXml (context, versionStr) {
9999
const {branch, repositoryUrl} = options
100100
const execaOpts = {env, cwd}
101101

102-
const commitMessage = versionStr.indexOf('SNAPSHOT') > -1
103-
? `Prepare next development iteration ${versionStr} [ci skip]`
104-
: `${versionStr} [ci skip]`
102+
const isSnapshotVersion = versionStr.indexOf('SNAPSHOT') > -1
103+
let commitMessage
104+
if (isSnapshotVersion) {
105+
commitMessage = `Prepare next development iteration ${versionStr}`
106+
if (options.disableSnapshotSkipCi == null || !options.disableSnapshotSkipCi) {
107+
commitMessage += ' [ci skip]'
108+
}
109+
} else {
110+
commitMessage = `${versionStr}`
111+
if (options.disableFinalSkipCi == null || !options.disableFinalSkipCi) {
112+
commitMessage += ' [ci skip]'
113+
}
114+
}
105115

106116
logger.log('adding pom.xml files to a commmit')
107117
await add(['pom.xml'], execaOpts)

0 commit comments

Comments
 (0)