mirror of
https://github.com/rancher/rancher-docs.git
synced 2026-09-25 04:28:15 +00:00
build updates
This commit is contained in:
+3
-21
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+28
-2
@@ -5,13 +5,15 @@ 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();
|
||||
@@ -166,7 +168,6 @@ gulp.task('pub-delete', () => {
|
||||
return del(['public/**', '!public']);
|
||||
});
|
||||
|
||||
|
||||
gulp.task('build:search-index', (cb) => {
|
||||
const env = process.env;
|
||||
|
||||
@@ -178,3 +179,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);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user