|
|
@ -26,7 +26,7 @@ var |
|
|
|
// admin files
|
|
|
|
github = require('../config/admin/github.js'), |
|
|
|
release = require('../config/admin/release'), |
|
|
|
project = require('../config/project/release'), |
|
|
|
project = require('../config/project/release'), |
|
|
|
|
|
|
|
|
|
|
|
// oAuth configuration for GitHub
|
|
|
@ -67,42 +67,51 @@ module.exports = function() { |
|
|
|
capitalizedComponent = component.charAt(0).toUpperCase() + component.slice(1), |
|
|
|
repoName = release.repoRoot + capitalizedComponent, |
|
|
|
|
|
|
|
gitOptions = { cwd: outputDirectory, quiet: true }, |
|
|
|
quietOptions = { args: '-q', cwd: outputDirectory, quiet: true }, |
|
|
|
checkoutOptions = { args: '--ours', cwd: outputDirectory }, |
|
|
|
pullOptions = { args: '', cwd: outputDirectory }, |
|
|
|
|
|
|
|
gitURL = 'https://github.com/' + release.org + '/' + repoName + '.git', |
|
|
|
repoURL = 'https://github.com/' + release.org + '/' + repoName + '/', |
|
|
|
|
|
|
|
componentPackage = fs.existsSync(outputDirectory + 'package.json' ) |
|
|
|
commitArgs = (oAuth.name !== undefined && oAuth.email !== undefined) |
|
|
|
? '--author "' + oAuth.name + ' <' + oAuth.email + '>"' |
|
|
|
: '', |
|
|
|
|
|
|
|
componentPackage = fs.existsSync(outputDirectory + 'package.json' ) |
|
|
|
? require(outputDirectory + 'package.json') |
|
|
|
: false, |
|
|
|
|
|
|
|
isNewVersion = (version && componentPackage.version != version), |
|
|
|
mergeMessage = 'Merged from upstream', |
|
|
|
|
|
|
|
commitMessage = (isNewVersion) |
|
|
|
? 'Updated component to version ' + version |
|
|
|
: 'Updated component release from Semantic-UI (Automatic)', |
|
|
|
: 'Updated automatically main repository', |
|
|
|
|
|
|
|
commitArgs = (oAuth.name !== undefined && oAuth.email !== undefined) |
|
|
|
? '--author "' + oAuth.name + ' <' + oAuth.email + '>"' |
|
|
|
: '', |
|
|
|
gitOptions = { cwd: outputDirectory }, |
|
|
|
commitOptions = { args: commitArgs, cwd: outputDirectory }, |
|
|
|
releaseOptions = { tag_name: version, owner: release.org, repo: repoName }, |
|
|
|
usernameOptions = { args : 'config user.name "' + oAuth.name + '"', cwd: outputDirectory }, |
|
|
|
emailOptions = { args : 'config user.email "' + oAuth.email + '"', cwd: outputDirectory }, |
|
|
|
|
|
|
|
localRepoSetup = fs.existsSync(path.join(outputDirectory, '.git')), |
|
|
|
canProceed = true |
|
|
|
localRepoSetup = fs.existsSync(path.join(outputDirectory, '.git')), |
|
|
|
canProceed = true |
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
console.info('Processing repository:' + outputDirectory); |
|
|
|
|
|
|
|
function setUser() { |
|
|
|
git.exec(usernameOptions, function () { |
|
|
|
git.exec(emailOptions, function () { |
|
|
|
commitFiles(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// standard path
|
|
|
|
function commitFiles() { |
|
|
|
// commit files
|
|
|
|
console.info('Committing ' + component + ' files', commitArgs); |
|
|
|
gulp.src('**/*', gitOptions) |
|
|
|
.pipe(git.add(gitOptions)) |
|
|
|
.pipe(git.commit(commitMessage, { args: commitArgs, cwd: outputDirectory })) |
|
|
|
.pipe(git.commit(commitMessage, commitOptions)) |
|
|
|
.on('error', function(error) { |
|
|
|
// canProceed = false; bug in git commit <https://github.com/stevelacy/gulp-git/issues/49>
|
|
|
|
}) |
|
|
@ -121,7 +130,7 @@ module.exports = function() { |
|
|
|
// push changess to remote
|
|
|
|
function pushFiles() { |
|
|
|
console.info('Pushing files for ' + component); |
|
|
|
git.push('origin', 'master', { args: '', cwd: outputDirectory }, function(error) { |
|
|
|
git.push('origin', 'master', { args: '-f', cwd: outputDirectory }, function(error) { |
|
|
|
console.info('Push completed successfully'); |
|
|
|
createRelease(); |
|
|
|
}); |
|
|
@ -129,11 +138,11 @@ module.exports = function() { |
|
|
|
|
|
|
|
// create release on GitHub.com
|
|
|
|
function createRelease() { |
|
|
|
console.log('Tagging release as ', version);/* |
|
|
|
github.createRelease(releaseOptions, { |
|
|
|
console.log('Tagging release as ', version); |
|
|
|
github.releases.createRelease(releaseOptions, function() { |
|
|
|
nextRepo(); |
|
|
|
tagFiles(); |
|
|
|
});*/ |
|
|
|
}); |
|
|
|
tagFiles(); |
|
|
|
} |
|
|
|
|
|
|
|