Skip to content

Commit

Permalink
Add commit stage (#75)
Browse files Browse the repository at this point in the history
* chore(release): publish

* added commit stage
  • Loading branch information
Charlie Sperbeck authored and whilke committed Jun 17, 2019
1 parent abf4649 commit 9cf22b6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions build/parameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class build {
get buildRepositoryProvider() { return process.env.BUILD_REPOSITORY_PROVIDER; }
get buildRepositoryTfvcWorkspace() { return process.env.BUILD_REPOSITORY_TFVC_WORKSPACE; }
get buildRepositoryUri() { return process.env.BUILD_REPOSITORY_URI; }
get buildRequestedFor() { return process.env.BUILD_REQUESTEDFOR; }
get buildRequestedForEmail() { return process.env.BUILD_REQUESTEDFOREMAIL; }
get buildRequestedForId() { return process.env.BUILD_REQUESTEDFORID; }
get buildSourceBranch() { return process.env.BUILD_SOURCEBRANCHNAME; }
Expand Down
17 changes: 16 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function build(done) {
if ((!!params.build.buildReason.match(/IndividualCI/ig) || !!params.build.buildReason.match(/BatchedCI/ig)) &&
!!params.build.buildSourceBranch.replace(/refs\/heads\/(feature\/)?/i, '').match(/master/ig)) {
console.log('Running Azure DevOps Release Build');
gulp.series(printVersion, adoPrep, toolInstall, lernaBuild, lernaPublish, systemPublish)(done);
gulp.series(printVersion, adoPrep, toolInstall, lernaBuild, lernaPublish, systemPublish, gitCommit )(done);
}

else if (!!params.build.buildReason.match(/PullRequest/ig)) {
Expand Down Expand Up @@ -72,6 +72,20 @@ function conditions(done) {
done();
}

function gitCommit(done) {
var branchName = params.build.buildSourceBranch.replace(/refs\/heads\/(feature\/)?/i, '');
var gitScript = `sudo git checkout ${branchName} &&
sudo git config user.email "${params.build.buildRequestedForEmail}" &&
sudo git config user.name "${params.build.buildRequestedFor}" &&
sudo git add . &&
sudo git commit --author '${params.build.buildRequestedFor} <${params.build.buildRequestedForEmail}>' --message "chore[skip ci]: Update & Commit Locks" &&
sudo git tag v${lerna.version} &&
sudo git push origin ${branchName} &&
sudo git push origin --tags`;
console.log('Git Script: ' + gitScript);
return shell.task(gitScript)(done());
}

function inlineCoverageSource() {
return gulp.src('./coverage/*.html')
.pipe(inlinesource({ attribute: false }))
Expand Down Expand Up @@ -237,6 +251,7 @@ function writeFilenameToFile() {
//Tasks
exports.build = build;
exports.conditions = conditions;
exports.commit = gitCommit;
exports.prep = adoPrep;
exports.analysis = gulp.series(sonarQube);
exports.cleancoverage = cleanCoverage;
Expand Down

0 comments on commit 9cf22b6

Please sign in to comment.