Merge pull request #426 from westlywright/master

build updates
This commit is contained in:
Vincent Fiduccia
2018-07-10 12:02:42 -07:00
committed by GitHub
6 changed files with 46 additions and 43 deletions
+3 -21
View File
@@ -18,13 +18,7 @@ pipeline:
repo: rancher/docs
context: .
tag: dev
secrets: [docker_username, docker_password, algolia_app_id, algolia_admin_key]
build_args:
- ALGOLIA_INDEX_NAME=dev_docs
- ALGOLIA_INDEX_FILE=public/algolia.json
build_args_from_env:
- ALGOLIA_APP_ID
- ALGOLIA_ADMIN_KEY
secrets: [docker_username, docker_password]
when:
branch: master
event: push
@@ -36,13 +30,7 @@ pipeline:
repo: rancher/docs
context: .
tag: staging
secrets: [docker_username, docker_password, algolia_app_id, algolia_admin_key]
build_args:
- ALGOLIA_INDEX_NAME=dev_docs
- ALGOLIA_INDEX_FILE=public/algolia.json
build_args_from_env:
- ALGOLIA_APP_ID
- ALGOLIA_ADMIN_KEY
secrets: [docker_username, docker_password]
when:
branch: master
event: push
@@ -54,13 +42,7 @@ pipeline:
repo: rancher/docs
context: .
tag: latest
secrets: [docker_username, docker_password, algolia_app_id, algolia_admin_key]
build_args:
- ALGOLIA_INDEX_NAME=prod_docs
- ALGOLIA_INDEX_FILE=public/algolia.json
build_args_from_env:
- ALGOLIA_APP_ID
- ALGOLIA_ADMIN_KEY
secrets: [docker_username, docker_password]
when:
branch: master
event: push
+1
View File
@@ -34,5 +34,6 @@ RUN gulp build
RUN stat /run/public/index.html
FROM nginx
VOLUME /usr/share/nginx/html/docs
COPY --from=build /run/public /usr/share/nginx/html/docs/
COPY nginx.conf /etc/nginx/conf.d/default.conf
+1
View File
@@ -33,5 +33,6 @@ RUN gulp build-staging
RUN stat /run/public/index.html
FROM nginx
VOLUME /usr/share/nginx/html/docs
COPY --from=build /run/public /usr/share/nginx/html/docs/
COPY nginx.conf /etc/nginx/conf.d/default.conf
+39 -11
View File
@@ -5,29 +5,34 @@ import gulp from 'gulp';
import del from 'del';
import runSequence from 'run-sequence';
import gulpLoadPlugins from 'gulp-load-plugins';
import { spawn } from "child_process";
import { spawn, exec } from "child_process";
import tildeImporter from 'node-sass-tilde-importer';
import browserify from 'browserify';
import source from 'vinyl-source-stream';
import buffer from 'vinyl-buffer';
import babelify from 'babelify';
import watch from 'gulp-watch';
const atomicalgolia = require("atomic-algolia");
const fs = require('fs');
const $ = gulpLoadPlugins();
const browserSync = require('browser-sync').create();
const isProduction = process.env.NODE_ENV === 'production';
const onError = (err) => {
console.log(err);
}
process.on('SIGINT', (err) => {
console.log('Caught SIGINT, exiting', '\r\n', err);
process.exit(0);
});
process.on('uncaughtException', (err) => {
console.log('Uncaught Exception, exiting', '\r\n', err);
process.exit(1);
});
console.log('&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&')
console.log(process.env)
console.log('&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&')
process.on('SIGINT', () => {
console.log('Caught SIGINT, exiting');
process.exit(0);
});
// --
gulp.task('dev', ['build-dev'], () => {
gulp.start('init-watch');
@@ -103,7 +108,6 @@ gulp.task('sass', () => {
return gulp.src([
'src/sass/**/*.scss'
])
.pipe($.plumber({ errorHandler: onError }))
.pipe($.sassLint())
.pipe($.sassLint.format())
.pipe($.sass({ precision: 5, importer: tildeImporter }))
@@ -169,7 +173,6 @@ gulp.task('pub-delete', () => {
return del(['public/**', '!public']);
});
gulp.task('build:search-index', (cb) => {
const env = process.env;
@@ -181,3 +184,28 @@ gulp.task('build:search-index', (cb) => {
cb();
});
});
gulp.task('publish:search-index', (cb) => {
const env = process.env;
const opts = {
stdio: 'inherit',
env: env
};
return exec('giddyup leader check', opts).on('close', code => {
if (code === 0) {
const rawdata = fs.readFileSync('public/final.algolia.json');
const merged = JSON.parse(rawdata);
atomicalgolia(process.env.ALGOLIA_INDEX_NAME, merged, (err, result) => {
console.log(result);
cb(err);
});
}
});
});
-1
View File
@@ -26,7 +26,6 @@
"gulp-imagemin": "^4.1.0",
"gulp-load-plugins": "^1.5.0",
"gulp-newer": "^1.3.0",
"gulp-plumber": "^1.1.0",
"gulp-sass": "^3.1.0",
"gulp-sass-lint": "^1.3.2",
"gulp-size": "^3.0.0",
+2 -10
View File
@@ -11,9 +11,6 @@ const nue = [];
const rawdata = fs.readFileSync('public/algolia.json');
const nodes = JSON.parse(rawdata);
console.log('&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&')
console.log(process.env)
console.log('&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&')
nodes.forEach(node => {
const dom = new JSDOM(node.content);
const content = dom.window.document.body; //post content wrapped in a body tag
@@ -83,10 +80,5 @@ nodes.forEach(node => {
const merged = [...nodes, ...nue];
// fs.writeFileSync('public/combined.algolia.json', JSON.stringify(merged));
// process.exit(0);
atomicalgolia(process.env.ALGOLIA_INDEX_NAME, merged, (err, result) => {
if (err) throw err;
console.log(result);
process.exit(0);
});
fs.writeFileSync('public/final.algolia.json', JSON.stringify(merged));
process.exit(0);