1
0
mirror of https://github.com/videojs/video.js.git synced 2024-12-23 02:04:34 +02:00
video.js/build/netlify-docs.js
2021-01-19 18:47:48 -05:00

15 lines
503 B
JavaScript

const sh = require('shelljs');
const semver = require('semver');
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 main branch and not on a tagged commit,
// error the build so it doesn't redeploy the docs
if (process.env.BRANCH === 'main' && semver.valid(output.trim()) === null) {
process.exit(1);
} else {
sh.exec('npm run docs:api');
sh.cp('-R', 'docs/legacy-docs', 'docs/api/docs');
}