From dddd01681190997897dce626ea83d8362560accb Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Fri, 2 Jun 2017 02:27:48 +0200 Subject: [PATCH] publishing --- Yavsc/Makefile | 36 +++++++++++++++++++ .../Shared/_ValidationScriptsPartial.cshtml | 4 +-- Yavsc/gulpfile.js | 25 +++++++++---- Yavsc/package.json | 1 + Yavsc/project.json | 2 +- 5 files changed, 59 insertions(+), 9 deletions(-) create mode 100644 Yavsc/Makefile diff --git a/Yavsc/Makefile b/Yavsc/Makefile new file mode 100644 index 00000000..f7d5d454 --- /dev/null +++ b/Yavsc/Makefile @@ -0,0 +1,36 @@ +DESTDIR=/srv/www/yavscpre +PRODDESTDIR=/srv/www/yavsc + +default: pushInPre + +cleanRelease: + rm -rf bin/Release + +cleanoutput: + rm -rf bin/output + +clean: cleanoutput cleanRelease + gulp clean + +bin/Release: + dnu build --configuration=Release + +bin/output: bin/Release + dnu publish + +bin/output/wwwroot/version: bin/output + git log -1 --pretty=format:%h > bin/output/wwwroot/version + +pushInPre: bin/output/wwwroot/version + ssh root@localhost systemctl stop kestrel-pre + ssh root@localhost rm -rf $(DESTDIR)/approot + (cd bin/output && rsync -ravu ./ root@localhost:$(DESTDIR) >/dev/null) + ssh root@localhost sync + ssh root@localhost systemctl start kestrel-pre + +push: bin/output/wwwroot/version + ssh root@localhost systemctl stop kestrel + ssh root@localhost rm -rf $(PRODDESTDIR)/approot + (cd bin/output && rsync -ravu ./ root@localhost:$(PRODDESTDIR) >/dev/null) + ssh root@localhost sync + ssh root@localhost systemctl start kestrel diff --git a/Yavsc/Views/Shared/_ValidationScriptsPartial.cshtml b/Yavsc/Views/Shared/_ValidationScriptsPartial.cshtml index 5474bb20..e03bf118 100755 --- a/Yavsc/Views/Shared/_ValidationScriptsPartial.cshtml +++ b/Yavsc/Views/Shared/_ValidationScriptsPartial.cshtml @@ -2,8 +2,7 @@ - - + + diff --git a/Yavsc/gulpfile.js b/Yavsc/gulpfile.js index 965faa1b..1aa052d5 100755 --- a/Yavsc/gulpfile.js +++ b/Yavsc/gulpfile.js @@ -3,11 +3,11 @@ var gulp = require("gulp"), rimraf = require("rimraf"), - // concat = require("gulp-concat"), cssmin = require("gulp-cssmin"), uglify = require("gulp-uglify"), shell = require("gulp-shell"), - rename = require('gulp-rename'); + rename = require('gulp-rename'), + clean = require('gulp-clean'); var webroot = "./wwwroot/"; @@ -31,8 +31,6 @@ gulp.task("clean:css", function(cb) { gulp.task("clean", ["clean:js", "clean:css"]); - - gulp.task('watch', shell.task(['ASPNET_ENV=Development dnx-watch web --configuration=Debug'])); gulp.task('watchlua', shell.task(['ASPNET_ENV=lua dnx-watch luatest --configuration=Debug'])); gulp.task('watchpre', shell.task(['ASPNET_ENV=yavscpre dnx-watch web --configuration=Debug'])); @@ -56,7 +54,22 @@ gulp.task("min", ["min:js", "min:css"]); gulp.task('build', shell.task(['dnu build --configuration=Debug'])); gulp.task('run', shell.task(['ASPNET_ENV=Development dnx web --configuration=Debug'])); gulp.task('buildrelease', shell.task(['dnu build --configuration=Release'])); -gulp.task('publish', shell.task(['dnu publish --configuration=Release'])); -gulp.task('postpublish', shell.task(['contrib/rsync-to-pre.sh'])); + + + +gulp.task('cleanoutput', () => { + gulp.src('bin/output', { read: false }).pipe(clean()) +}); +gulp.task('dnupublish', ['cleanoutput'], () => { + shell.task(['dnu publish --configuration=Release', + 'git log -1 --pretty=format:%h > bin/output/wwwroot/version' + ]).apply(); +}); +gulp.task('pushinpre', ['dnupublish'], () => { + shell.task('contrib/rsync-to-pre.sh').apply(); +}) +gulp.task('pushinprod', ['dnupublish'], () => { + shell.task('contrib/rsync-to-prod.sh').apply(); +}) gulp.task("default", ["watch"]); \ No newline at end of file diff --git a/Yavsc/package.json b/Yavsc/package.json index 2cfdc3ae..53b05739 100644 --- a/Yavsc/package.json +++ b/Yavsc/package.json @@ -4,6 +4,7 @@ "devDependencies": { "grunt": "^1.0.1", "gulp": "^3.9.0", + "gulp-clean": "^0.3.2", "gulp-concat": "2.5.2", "gulp-cssmin": "^0.1.7", "gulp-dnx-tasks": "^1.0.0-beta7", diff --git a/Yavsc/project.json b/Yavsc/project.json index 0d5d9d46..a0270739 100755 --- a/Yavsc/project.json +++ b/Yavsc/project.json @@ -161,7 +161,7 @@ "prerestore": "echo before restoring packages", "postrestore": "echo after restoring packages", "prepublish": "gulp min", - "postpublish": "echo \"Use contrib/rsync-to-pre.sh # to push in prod.\"" + "postpublish": "echo after publish" }, "embed": "Views/**/*.cshtml" } \ No newline at end of file