2017-12-05 00:42:07 +02:00
|
|
|
const sh = require('shelljs');
|
2018-01-24 20:47:07 +02:00
|
|
|
const semver = require('semver');
|
2017-12-05 00:42:07 +02:00
|
|
|
|
2018-01-24 20:47:07 +02:00
|
|
|
const GIT_LOG = `git log --format=%B -n 1 ${process.env.COMMIT_REF}`;
|
2019-08-30 20:14:53 +02:00
|
|
|
const output = sh.exec(GIT_LOG, {async: false, silent: true}).stdout;
|
2018-01-05 23:42:11 +02:00
|
|
|
|
2021-01-20 01:47:48 +02:00
|
|
|
// if we're on main branch and not on a tagged commit,
|
2017-12-05 00:42:07 +02:00
|
|
|
// error the build so it doesn't redeploy the docs
|
2021-01-20 01:47:48 +02:00
|
|
|
if (process.env.BRANCH === 'main' && semver.valid(output.trim()) === null) {
|
2017-12-05 00:42:07 +02:00
|
|
|
process.exit(1);
|
|
|
|
} else {
|
|
|
|
sh.exec('npm run docs:api');
|
|
|
|
sh.cp('-R', 'docs/legacy-docs', 'docs/api/docs');
|
|
|
|
}
|