Skip to content

Commit

Permalink
Build github-pages gzip in a separate folder
Browse files Browse the repository at this point in the history
  • Loading branch information
cjshmyr committed Aug 15, 2023
1 parent 338a4dd commit fa1f1a0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/npm-gulp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Upload GitHub Pages artifact
uses: actions/[email protected] #https://github.com/actions/upload-pages-artifact
with:
path: ./dist
path: ./dist-pages

deploy:
needs: build
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
package-lock.json
node_modules/
dist/
dist-pages/
27 changes: 11 additions & 16 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,16 @@ const buffer = require('vinyl-buffer');
const watchify = require('watchify');
const fancy_log = require('fancy-log');
const tar = require('gulp-tar');
const gzip = require('gulp-gzip');
const rename = require('gulp-rename');
const zip = require('gulp-zip');
const {rimraf} = require('rimraf');
const yargs = require('yargs');

const argv = yargs.argv;
const noSourceMaps = argv.noSourceMaps !== undefined;

const destPath = './dist';
const destPathContent = destPath + '/**';

const githubPagesTarFile = 'github-pages.tar';
const githubPagesGzipFile = 'github-pages';
const githubPagesPath = './dist-pages';

const watchedBrowserify = watchify(
browserify({
Expand Down Expand Up @@ -83,24 +80,22 @@ gulp.task('stop-watchify', function (done) {
done();
});

gulp.task('github-pages-tar', () => {
return gulp.src(destPathContent)
.pipe(tar(githubPagesTarFile))
.pipe(gulp.dest(destPath))
});
gulp.task('github-pages-clean', () => {
return rimraf(githubPagesPath);
})

gulp.task('github-pages-gzip', () => {
return gulp.src(destPath + '/' + githubPagesTarFile)
.pipe(gzip())
.pipe(rename('github-pages'))
.pipe(gulp.dest(destPath))
});
return gulp.src(destPath + '/**')
.pipe(tar('content.tar'))
.pipe(zip('github-pages'))
.pipe(gulp.dest(githubPagesPath));
})

gulp.task('build',
gulp.series(
gulp.parallel('clean'),
gulp.parallel('html', 'scripts', 'assets'),
gulp.parallel('github-pages-tar'),
gulp.parallel('github-pages-clean'),
gulp.parallel('github-pages-gzip'),
gulp.parallel('stop-watchify')
)
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"gulp-tar": "^3.1.0",
"gulp-terser": "^2.1.0",
"gulp-typescript": "^6.0.0-alpha.1",
"gulp-zip": "^5.1.0",
"rimraf": "^5.0.1",
"tsify": "^5.0.4",
"typescript": "^4.9.5",
Expand Down

0 comments on commit fa1f1a0

Please sign in to comment.