Skip to content

Commit

Permalink
fix: added git push to auto npm versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanneff committed Mar 7, 2017
1 parent f353eca commit 3b0c9cc
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/scripts/npm/nodeVersion.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(function () {
var path = require('path')
var exec = require('child_process').exec
var fileHelper = require('../lib/fileHelper.js')
var FILES = ['package.json', 'plugin.xml', 'plugin.template.xml']

Expand All @@ -9,14 +10,26 @@
function updateNpmVersion (pluginConfig, config, callback) {
var files = readFilePaths(FILES)
var version = config.nextRelease.version
var git = ''

for (var i = 0; i < files.length; i++) {
var file = files[i]
var content = readContent(file)

git += 'git add ' + file + ' && '
content = updateVersion(file, content, version)
saveContent(file, content)
}
commitChanges(git, version)
}

function commitChanges (git, version) {
git += 'git commit -m "chore: updated npm version to '+ version + '" && git push'
exec(git, function (err, stdout, stderr) {
if (err) {
throw new Error('BRANCH SDK: Failed commit git changes to npm version. Docs https://goo.gl/GijGKP')
}
})
}

function readContent (file) {
Expand Down

0 comments on commit 3b0c9cc

Please sign in to comment.