Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Commit

Permalink
build(git): only deploy site if it's a new commit, fixes #3655
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelSolati committed Apr 21, 2021
1 parent 9a01c36 commit bf3366f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
18 changes: 18 additions & 0 deletions gulp-tasks/write-head.js
@@ -0,0 +1,18 @@
const isProd = process.env.ELEVENTY_ENV === 'prod';

/**
* Write the HEAD SHA to the `dist` on prod builds.
*
* @returns {Promise<void>}
*/
const writeHead = async () => {
if (isProd) {
const HEAD = require('child_process')
.execSync('git rev-parse HEAD')
.toString()
.trim();
require('fs').writeFileSync('./dist/HEAD', HEAD);
}
};

module.exports = writeHead;
2 changes: 2 additions & 0 deletions gulpfile.js
Expand Up @@ -21,6 +21,7 @@ const copyFonts = require('./gulp-tasks/copy-fonts.js');
const copyGlobalImages = require('./gulp-tasks/copy-global-images.js');
const copyMisc = require('./gulp-tasks/copy-misc.js');
const sassTask = require('./gulp-tasks/sass.js');
const writeHead = require('./gulp-tasks/write-head.js');

gulp.task('copy-content-assets', copyContentAssets);
gulp.task('default-locale', copyDefaultLocale);
Expand All @@ -35,6 +36,7 @@ gulp.task(
copyContentAssets,
copyFonts,
sassTask,
writeHead,
),
);

Expand Down

0 comments on commit bf3366f

Please sign in to comment.