From a7cc4f4a45fc76aab79e72b05be788a44af688b8 Mon Sep 17 00:00:00 2001 From: Rohit pai Date: Sat, 1 Jan 2022 00:26:39 +0000 Subject: [PATCH] updated gulpfile to work with github --- .github/workflows/ftpDeploy.yml | 1 + gulpfile.js | 29 ++++++++++++++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ftpDeploy.yml b/.github/workflows/ftpDeploy.yml index f7148bb..574fd44 100644 --- a/.github/workflows/ftpDeploy.yml +++ b/.github/workflows/ftpDeploy.yml @@ -15,6 +15,7 @@ jobs: - name: 🔨Run Gulp run: | + export github="true" npm install npm start diff --git a/gulpfile.js b/gulpfile.js index 1104443..04fb910 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -6,10 +6,12 @@ const terser = require("gulp-terser"); const ftp = require("vinyl-ftp"); const env = require("gulp-env"); -env({ +/*env({ file: ".env", type: ".ini" -}); +});*/ + +const github = (process.env.github) ? true : false; gulp.task("minifyHTML", () => { @@ -57,7 +59,7 @@ gulp.task("watchFiles", () => gulp.watch("src/api/*.php", gulp.task("movePHPFiles")) }); -gulp.task("ftp", () => +/*gulp.task("ftp", () => { let conn = ftp.create( { @@ -69,12 +71,12 @@ gulp.task("ftp", () => return gulp.src("dist/**", {base: "dist", dot: true}) .pipe(conn.newerOrDifferentSize("/")) .pipe(conn.dest("/")); -}); +});*/ -gulp.task("deploy", () => +/*gulp.task("deploy", () => { gulp.watch("dist", gulp.task("ftp")); -}); +});*/ gulp.task("browserSync", () => { @@ -89,4 +91,17 @@ gulp.task("browserSync", () => gulp.watch("dist").on("change", browserSync.reload) }); -gulp.task("default", gulp.series(gulp.parallel("watchFiles", "browserSync"))); +gulp.task("default", () => +{ + if(github) + { + (gulp.series("movePHPFiles", "minifyJS", "minifyHTML", "minifyCSS")()); + } + else + { + (gulp.series("watchFiles", "browserSync")()); + } +} + +//gulp.task("default", gulp.series(gulp.parallel("watchFiles", "browserSync"))); +