Simplified deployment

This commit is contained in:
Roman Hotsiy 2016-05-29 20:47:38 +03:00
parent 9df1c450e8
commit 40b03e993c
3 changed files with 8 additions and 26 deletions

View File

@ -5,28 +5,20 @@ require('shelljs/global');
var paths = require('./paths');
var path = require('path');
// copy old releases
mkdir('-p', '.ghpages-tmp');
cd('.ghpages-tmp');
// reset local changes before checkout
exec('git reset --hard');
exec('git fetch origin gh-pages:gh-pages');
exec('git checkout gh-pages');
cp('-R', '../releases/*', '.');
exec('git checkout @{-1}');
cd('..');
set('-e');
set('-v');
// build
exec('npm run build-dist');
cd('demo');
mkdir('-p', 'dist');
cp('-R', '../dist/*', './dist/');
mkdir('-p', 'releases');
cp('-R', '../.ghpages-tmp/*', './releases/');
cd('..');
var version = 'v' + require(path.join(__dirname, '../package.json')).version + '/';
var versionDir = path.join(paths.releases, version);
var latestDir = path.join(paths.releases, 'latest/');
mkdir('-p', versionDir)
mkdir('-p', latestDir);
cp(paths.redocBuilt + '.min.js', versionDir);
cp(paths.redocBuilt + '.min.js', path.join(paths.releases, 'latest/'));
cp(paths.redocBuilt + '.min.js', latestDir);

View File

@ -1,10 +0,0 @@
var gulp = require('gulp');
var path = require('path');
var paths = require('../paths');
gulp.task('copy-version', function() {
var tag = 'v' + require(path.join(__dirname, '../../package.json')).version;
gulp.src(paths.redocBuilt + '.min.js')
.pipe(gulp.dest(path.join(paths.releases, tag)))
.pipe(gulp.dest(path.join(paths.releases, 'latest')));
});

View File

@ -15,7 +15,7 @@
"branch-release": "git reset --hard && branch-release",
"unit": "gulp test",
"e2e": "gulp e2e --prod",
"deploy": "node ./build/prepare_deploy.js && deploy-to-gh-pages demo"
"deploy": "node ./build/prepare_deploy.js && deploy-to-gh-pages --update demo"
},
"keywords": [
"OpenAPI",
@ -76,7 +76,7 @@
"branch-release": "^0.3.2",
"browser-sync": "^2.10.1",
"del": "^2.2.0",
"deploy-to-gh-pages": "^1.0.0",
"deploy-to-gh-pages": "^1.1.2",
"gulp": "^3.9.1",
"gulp-concat": "^2.6.0",
"gulp-eslint": "^1.1.1",