-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add .travis.yml & scripts for automatic build and release
- Loading branch information
Showing
8 changed files
with
3,281 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
language: node_js | ||
node_js: | ||
- "8" | ||
|
||
install: | ||
- echo $TRAVIS_BRANCH | ||
- echo $TRAVIS_JOB_ID | ||
- echo $TRAVIS_JOB_NUMBER | ||
- git log -1 --pretty=oneline | ||
|
||
before_script: | ||
- npm install -g gulp-cli | ||
- npm install jsonfile | ||
|
||
script: | ||
- bash deploy.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
if git log -1 --pretty=oneline | grep -v 'Version auto-incremented' | ||
then | ||
if echo $TRAVIS_BRANCH | grep master | ||
then | ||
echo "Building release" | ||
node increment_version.js | ||
git commit -a -m "Version auto-incremented - $TRAVIS_JOB_NUMBER" | ||
gulp build | ||
gulp release | ||
git remote add github https://$GITHUB_TOKEN@github.com/bywatersolutions/koha-plugin-unused-authority-check | ||
git fetch --all | ||
git push github HEAD:master | ||
fi | ||
else | ||
echo "No release needing." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const jsonfile = require('jsonfile') | ||
const file = 'package.json' | ||
|
||
let json = jsonfile.readFileSync(file); | ||
|
||
console.log("Version: " + json.version ); | ||
console.log("Previous Version: " + json.previous_version ); | ||
|
||
const version = json.version; | ||
const version_parts = version.split('.'); | ||
let major = parseInt( version_parts[0] ); | ||
let minor = parseInt( version_parts[1] ); | ||
let patch = parseInt( version_parts[2] ); | ||
|
||
const prev_version = json.previous_version; | ||
const prev_version_parts = prev_version.split('.'); | ||
let prev_major = parseInt( version_parts[0] ); | ||
let prev_minor = parseInt( version_parts[1] ); | ||
let prev_patch = parseInt( version_parts[2] ); | ||
|
||
let new_version; | ||
|
||
// No version jumps, just increment patch version | ||
if ( major == prev_major && minor == prev_minor ) { | ||
prev_major = major; | ||
prev_minor = minor; | ||
prev_patch = patch; | ||
|
||
patch++; | ||
|
||
new_version = major + '.' + minor + '.' + patch; | ||
} else { // Version jumped, don't increment patch | ||
new_version = version; | ||
} | ||
|
||
json.previous_version = version; | ||
json.version = new_version; | ||
|
||
jsonfile.writeFile(file, json, {spaces: 2}, function (err) { | ||
if (err) console.error("ERROR: " + err); | ||
}) | ||
|
||
console.log("New Version: " + json.version ); | ||
console.log("New Previous Version: " + json.previous_version ); |
Oops, something went wrong.