mirror of
https://github.com/videojs/video.js.git
synced 2025-07-05 00:58:52 +02:00
docs: deploy docs using netlify (#4774)
This adds in the legacy docs into the repo and enables automatic deployment via netlify. The netlify-docs.js script will error out the build on netlify on master if we're not on a tagged commit so that it won't redeploy the docs unless there's a new release. If we're not on master or on master with a tagged commit, it will process with the deploy. Also, this removes the API docs from being published with npm, fixes #4609.
This commit is contained in:
19
build/netlify-docs.js
Normal file
19
build/netlify-docs.js
Normal file
@ -0,0 +1,19 @@
|
||||
const sh = require('shelljs');
|
||||
|
||||
const GIT_CONTAINS = `git tag --contains ${process.env.COMMIT_REF}`;
|
||||
|
||||
const output = sh.exec(GIT_CONTAINS, {async: false, silent:true}).stdout;
|
||||
|
||||
// if we're on master branch and not on a tagged commit,
|
||||
// error the build so it doesn't redeploy the docs
|
||||
if (process.env.BRANCH === 'master' && output === '') {
|
||||
process.exit(1);
|
||||
|
||||
// if we're on any other branch, we can regenerate docs
|
||||
} else {
|
||||
// generate the docs
|
||||
sh.exec('npm run docs:api');
|
||||
|
||||
// copy the legacy docs over
|
||||
sh.cp('-R', 'docs/legacy-docs', 'docs/api/docs');
|
||||
}
|
Reference in New Issue
Block a user