Skip to content

Commit

Permalink
Use scripts from coursier to handle website (#306)
Browse files Browse the repository at this point in the history
Referencing https://github.com/coursier/docusaurus-mdoc-scripts as a
submodule in particular
  • Loading branch information
alexarchambault committed Jan 16, 2019
1 parent 7e65de1 commit 2ff4799
Show file tree
Hide file tree
Showing 10 changed files with 221 additions and 267 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
@@ -0,0 +1,3 @@
[submodule "scripts/website"]
path = scripts/website
url = https://github.com/coursier/docusaurus-mdoc-scripts.git
21 changes: 16 additions & 5 deletions .travis.yml
Expand Up @@ -9,14 +9,16 @@ cache:
git:
depth: false
before_install:
- source scripts/setup-build-tools.sh
- source scripts/website/setup-build-tools.sh
sudo: required
stages:
- name: test
- name: release
if: (branch = master AND type = push) OR (tag IS present)
- name: upload-launcher
if: tag IS present
- name: update-versioned-docs
if: tag IS present
- name: update-website
if: (branch = master AND type = push) OR (tag IS present)
jobs:
Expand All @@ -41,15 +43,24 @@ jobs:
- scala: 2.12.8
jdk: openjdk11
- name: "Website"
script: scripts/update-website.sh
script: amm scripts/site.sc --publishLocal true
- stage: release
script: sbt ci-release
- stage: update-website
env: PUSH_WEBSITE=1
script: scripts/update-website.sh
- stage: upload-launcher
name: "Upload launcher"
script: scripts/upload-launcher.sh
- stage: update-versioned-docs
env: WEBSITE_DIR=docs/website VERSIONED_DOCS_REPO=almond-sh/versioned-docs
script:
- amm scripts/site.sc --publishLocal true --npmInstall true --yarnRunBuild true
- scripts/website/versioned-docs.sh --update
- stage: update-website
env: WEBSITE_DIR=docs/website REPO=almond-sh/almond VERSIONED_DOCS_REPO=almond-sh/versioned-docs
name: "Push website"
script:
- scripts/website/versioned-docs.sh
- amm scripts/site.sc --publishLocal true --npmInstall true --yarnRunBuild true --relativize true
- scripts/website/push-website.sh
branches:
only:
- master
Expand Down
112 changes: 112 additions & 0 deletions docs/website/pages/en/versions.js
@@ -0,0 +1,112 @@
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

const React = require('react');

const CompLibrary = require('../../core/CompLibrary');

const Container = CompLibrary.Container;

const CWD = process.cwd();

const siteConfig = require(process.cwd() + '/siteConfig.js');
try {
var versions = require(`${CWD}/versions.json`);
} catch (e) {
var versions = [];
}

function Versions() {
const latestVersion = versions[0] || '';
const language = '';
const repoUrl = `https://github.com/${siteConfig.organizationName}/${
siteConfig.projectName
}`;
return (
<div className="docMainWrapper wrapper">
<Container className="mainContainer versionsContainer">
<div className="post">
<header className="postHeader">
<h1>{siteConfig.title} Versions</h1>
</header>
<h3 id="latest">Current version</h3>
<table className="versions">
<tbody>
<tr>
<th>{latestVersion}</th>
<td>
<a
href={`${siteConfig.baseUrl}docs/intro`}>
Documentation
</a>
</td>
<td>
<a href={`${repoUrl}/releases/tag/v${latestVersion}`}>
Release Notes
</a>
</td>
</tr>
</tbody>
</table>
<h3 id="rc">Latest Version</h3>
Here you can find the latest documentation and unreleased code.
<table className="versions">
<tbody>
<tr>
<th>master</th>
<td>
<a
href={`${siteConfig.baseUrl}docs/next/intro`}>
Documentation
</a>
</td>
<td>
<a href={repoUrl}>Source Code</a>
</td>
</tr>
</tbody>
</table>
<h3 id="archive">Past Versions</h3>
<p>
Here you can find documentation for previous versions.
</p>
<table className="versions">
<tbody>
{versions.map(
version =>
version !== latestVersion && (
<tr key={version}>
<th>{version}</th>
<td>
<a
href={`${siteConfig.baseUrl}docs/${version}/intro`}>
Documentation
</a>
</td>
<td>
<a href={`${repoUrl}/releases/tag/v${version}`}>
Release Notes
</a>
</td>
</tr>
),
)}
</tbody>
</table>
<p>
You can find past versions of this project on{' '}
<a href={`${repoUrl}/releases`}>GitHub</a>.
</p>
</div>
</Container>
</div>
);
}

Versions.title = 'Versions';

module.exports = Versions;
78 changes: 0 additions & 78 deletions scripts/generate-website.sh

This file was deleted.

75 changes: 0 additions & 75 deletions scripts/push-website.sh

This file was deleted.

0 comments on commit 2ff4799

Please sign in to comment.