Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for publish with GitHub pages #1

Merged
merged 3 commits into from
Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Deploy to GitHub Pages

on:
push:
branches:
- master

jobs:
deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 18
cache: npm

- name: Install dependencies
run: npm ci

- name: Build website
env:
# Optional base url set in repo secrets e.g. /rchain-docs/
# Workaround for https://github.com/facebook/docusaurus/issues/448
BASE_URL: ${{ secrets.BASE_URL }}
run: npm run build

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
23 changes: 23 additions & 0 deletions .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Test deployment

on:
pull_request:
branches:
- master

jobs:
test-deploy:
name: Test deployment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version: 18
cache: npm

- name: Install dependencies
run: npm ci

- name: Test build website
run: npm run build
2 changes: 1 addition & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const config = {
title: 'RChain docs',
tagline: 'RChain general documentations : dev | validation | staking',
url: 'https://docs.rchain.coop',
baseUrl: '/',
baseUrl: process.env.BASE_URL ?? '/',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'warn',
favicon: 'img/favicon.png',
Expand Down
16 changes: 12 additions & 4 deletions src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import React from 'react';
import { Redirect } from 'react-router-dom';
import { Redirect } from 'react-router-dom';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import useBaseUrl from '@docusaurus/useBaseUrl';

export default function Home() {
return <Redirect to='/docs/development/dev_on_rchain' />;
}
export default function Home () {
const context = useDocusaurusContext();

// Retrieve reference to home page redirect
const homeDoc = context.siteConfig.themeConfig.navbar.items[0]
const homeDocUrl = useBaseUrl(`docs/${homeDoc.docId}`)

return <Redirect to={homeDocUrl} />;
}