1
0
mirror of https://github.com/videojs/video.js.git synced 2025-07-05 00:58:52 +02:00

chore: netlify ci demo and docs (#7045)

This commit is contained in:
Brandon Casey
2021-01-19 18:47:48 -05:00
committed by GitHub
parent e240396f5a
commit 9574bb4ad5
6 changed files with 43 additions and 57 deletions

View File

@ -1,26 +1,14 @@
const sh = require('shelljs');
const semver = require('semver');
const generateExample = require('./generate-example.js').generateExample;
const GIT_LOG = `git log --format=%B -n 1 ${process.env.COMMIT_REF}`;
const output = sh.exec(GIT_LOG, {async: false, silent: true}).stdout;
// if we're on master branch and not on a tagged commit,
// if we're on main branch and not on a tagged commit,
// error the build so it doesn't redeploy the docs
if (process.env.BRANCH === 'master' && semver.valid(output.trim()) === null) {
if (process.env.BRANCH === 'main' && semver.valid(output.trim()) === null) {
process.exit(1);
// if we're on any other branch, we can regenerate docs
} else {
if (process.env.BRANCH !== 'master') {
// generate the example
generateExample();
}
// generate the docs
sh.exec('npm run docs:api');
// copy the legacy docs over
sh.cp('-R', 'docs/legacy-docs', 'docs/api/docs');
}