Deploy showcase, support when building gh-pages on master.

Summary:
Addresses #9865.

We want the showcase and support pages to be loaded from root regardless of which React Native version is selected.
Closes https://github.com/facebook/react-native/pull/10004

Differential Revision: D3896505

Pulled By: bestander

fbshipit-source-id: 0db64f72bca8bc68d6d489fa3ed34c0a6f671002
This commit is contained in:
Héctor Ramos 2016-09-20 15:56:16 -07:00 committed by Facebook Github Bot 8
parent 0c7ccfe172
commit 999ebb154d
2 changed files with 15 additions and 10 deletions

View File

@ -15,8 +15,8 @@ var AlgoliaDocSearch = require('AlgoliaDocSearch');
var HeaderLinks = React.createClass({
linksInternal: [
{section: 'docs', href: 'docs/getting-started.html', text: 'Docs', target: '.nav-docs'},
{section: 'support', href: 'support.html', text: 'Support'},
{section: 'showcase', href: 'showcase.html', text: 'Showcase'},
{section: 'support', href: '/react-native/support.html', text: 'Support'},
{section: 'showcase', href: '/react-native/showcase.html', text: 'Showcase'},
{section: 'blog', href: '/react-native/blog/', text: 'Blog'},
],
linksExternal: [

View File

@ -23,12 +23,12 @@ if (!which(`git`)) {
}
let version;
let isBlogToBeDeployed = false;
let areVersionlessSectionsToBeDeployed = false;
if (CIRCLE_BRANCH.indexOf(`-stable`) !== -1) {
version = CIRCLE_BRANCH.slice(0, CIRCLE_BRANCH.indexOf(`-stable`));
} else if (CIRCLE_BRANCH === `master`) {
version = `next`;
isBlogToBeDeployed = true;
areVersionlessSectionsToBeDeployed = true;
}
rm(`-rf`, `build`);
@ -85,8 +85,9 @@ if (!CI_PULL_REQUEST && CIRCLE_PROJECT_USERNAME === `facebook`) {
exit(1);
}
cd(`build/react-native-gh-pages`);
// blog, showcase, support are copied separately
let toCopy = ls(`../react-native`)
.filter(file => file !== `blog`)
.filter(file => (file !== `blog`) && (file !== `showcase.html`) && (file !== `support.html`))
.map(file => `../react-native/${file}`);
cp(`-R`, toCopy, `releases/${version}`);
// versions.html is located in root of website and updated with every release
@ -96,7 +97,7 @@ if (!CI_PULL_REQUEST && CIRCLE_PROJECT_USERNAME === `facebook`) {
if (currentCommit === latestTagCommit) {
echo(`------------ DEPLOYING latest`);
// leave only releases and blog folder
rm(`-rf`, ls(`*`).filter(name => (name !== 'releases') && (name !== 'blog')));
rm(`-rf`, ls(`*`).filter(name => (name !== 'releases') && (name !== 'blog') && (name !== 'showcase.html') && (name !== 'support.html')));
cd(`../..`);
if (exec(`RN_VERSION=${version} RN_LATEST_VERSION=${latestVersion} \
RN_AVAILABLE_DOCS_VERSIONS=${versions} node server/generate.js`).code !== 0) {
@ -104,17 +105,21 @@ if (!CI_PULL_REQUEST && CIRCLE_PROJECT_USERNAME === `facebook`) {
exit(1);
}
cd(`build/react-native-gh-pages`);
// blog is copied separately
// blog, showcase, support are copied separately
let toCopy = ls(`../react-native`)
.filter(file => file !== `blog`)
.filter(file => (file !== `blog`) && (file !== `showcase.html`) && (file !== `support.html`))
.map(file => `../react-native/${file}`);
cp(`-R`, toCopy, `.`);
}
// blog is versionless, we always build it in root file
if (isBlogToBeDeployed) {
// blog, showcase, support are versionless, we always build them in root file
if (areVersionlessSectionsToBeDeployed) {
echo(`------------ COPYING blog`);
rm(`-rf`, `blog`);
cp(`-R`, `../react-native/blog`, `.`);
echo(`------------ COPYING showcase`);
cp(`../react-native/showcase.html`, `.`);
echo(`------------ COPYING support`);
cp(`../react-native/support.html`, `.`);
}
if (currentCommit === latestTagCommit || version) {
exec(`git status`);