CI now builds docs website and deploys it to /%version% path

Summary:
Copy of #5760 reverted merge.

We need to preserve history of docs changes on the webserver.
The goal is to allow users to browse outdated versions of docs.
To make things simple all websites will be released to https://facebook.github.io/react-native/releases/version/XX folder when there is a branch cut.

I switched from Travis CI to Cirle CI because it works faster and I am more familiar with it.

How it works:

1. If code is pushed to `master` branch then CI will build a fresh version of docs and put it in https://github.com/facebook/react-native/tree/gh-pages/releases/next folder.
Github will serve this website from https://facebook.github.io/react-native/releases/version/next URL.
All relative URLs will work within that website

2. If code is pushed to `0.20-stable` branch then CI will build a fresh version of docs and put it in https://github.com/facebook/react-native/tree/gh-pages/releases/0.20 folder.
Github will serve this website from https://facebook.github.io/react-native/releases/v
Closes https://github.com/facebook/react-native/pull/5873

Reviewed By: svcscm

Differential Revision: D2926901

Pulled By: androidtrunkagent

fb-gh-sync-id: 16aea430bac815933d9c603f03921cc6353906f1
shipit-source-id: 16aea430bac815933d9c603f03921cc6353906f1
This commit is contained in:
Konstantin Raev
2016-02-11 06:16:34 -08:00
committed by facebook-github-bot-0
parent 0b89b18b1b
commit 6f1417c849
44 changed files with 234 additions and 186 deletions

View File

@@ -72,7 +72,7 @@ var DocsSidebar = React.createClass({
if (metadata.permalink.match(/^https?:/)) {
return metadata.permalink;
}
return '/react-native/' + metadata.permalink + '#content';
return metadata.permalink + '#content';
},
render: function() {

View File

@@ -14,11 +14,11 @@ var AlgoliaDocSearch = require('AlgoliaDocSearch');
var HeaderLinks = React.createClass({
linksInternal: [
{section: 'docs', href: '/react-native/docs/getting-started.html', text: 'Docs'},
{section: 'support', href: '/react-native/support.html', text: 'Support'},
{section: 'docs', href: 'docs/getting-started.html', text: 'Docs'},
{section: 'support', href: 'support.html', text: 'Support'},
{section: 'releases', href: 'https://github.com/facebook/react-native/releases', text: 'Releases'},
{section: 'newsletter', href: 'http://reactnative.cc', text: 'Newsletter'},
{section: 'showcase', href: '/react-native/showcase.html', text: 'Showcase'},
{section: 'showcase', href: 'showcase.html', text: 'Showcase'},
],
linksExternal: [
{section: 'github', href: 'https://github.com/facebook/react-native', text: 'GitHub'},

View File

@@ -11,9 +11,12 @@
var React = require('React');
var HeaderLinks = require('HeaderLinks');
var Metadata = require('Metadata');
var Site = React.createClass({
render: function() {
const path = Metadata.config.RN_DEPLOYMENT_PATH;
var basePath = '/react-native/' + (path ? path + '/' : '');
var title = this.props.title ? this.props.title + ' ' : '';
var currentYear = (new Date()).getFullYear();
title += 'React Native | A framework for building native apps using React';
@@ -30,10 +33,12 @@ var Site = React.createClass({
<meta property="og:image" content="http://facebook.github.io/react-native/img/opengraph.png?2" />
<meta property="og:description" content="A framework for building native apps using React" />
<base href={basePath} />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css" />
<link rel="shortcut icon" href="/react-native/img/favicon.png?2" />
<link rel="stylesheet" href="/react-native/css/react-native.css" />
<link rel="shortcut icon" href="img/favicon.png?2" />
<link rel="stylesheet" href="css/react-native.css" />
<script type="text/javascript" src="//use.typekit.net/vqa1hcx.js"></script>
<script type="text/javascript">{'try{Typekit.load();}catch(e){}'}</script>
@@ -43,8 +48,8 @@ var Site = React.createClass({
<div className="container">
<div className="nav-main">
<div className="wrap">
<a className="nav-home" href="/react-native/">
<img src="/react-native/img/header_logo.png" />
<a className="nav-home" href="">
<img src="img/header_logo.png" />
React Native
</a>
<HeaderLinks section={this.props.section} />
@@ -72,7 +77,7 @@ var Site = React.createClass({
fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");
`}} />
<script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/1/docsearch.min.js"></script>
<script src="/react-native/js/scripts.js" />
<script src="js/scripts.js" />
</body>
</html>
);