Skip to main content

Deploy your site

Docusaurus is a static-site-generator (also called Jamstack).

It builds your site as simple static HTML, JavaScript and CSS files.

There are many ways to make the static build (CDN, blob storage, a pod in your k8s cluster to name a few) available. This template supports two easiest. But feel free to use the approach most appropriate to your needs.

To deploy on GitHub pages, in your repository visit section Settings -> Pages. In Build and Deployment select GitHub Actions as Source. From suggested actions select Static HTML. GitHub actions source

GitHub prepare workflow file with prepopulated content. Replace whole file with the following content and commit changes.

# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Pages
uses: actions/configure-pages@v2
- uses: borales/actions-yarn@v3.0.0
with:
cmd: install # will run `yarn install` command
- uses: borales/actions-yarn@v3.0.0
with:
cmd: build # will run `yarn build` command
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
# Upload build directory
path: 'build/'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1

Custom domain

To use custom domain, you need to create CNAME DNS record pointing to datamole-ai.github.io.

Next, in repository Settings -> Pages in under Custom domain set your domain name. Setting custom domain for GitHub deployment

Azure Static Websites (ASW)

You should consider this approach for private documentations or documentation requiring authentication. ASW is a paid service. Deployment to ASW is handled by GitHub workflow .github/workflows/deploy-asw.yml.

To make it working, you need to create ASW to get api token. This token must be stored in GitHub action secrets with name AZURE_STATIC_WEB_APPS_API_TOKEN.

Get more information about setting ASW in Azure Portal or contact SRE team.

Authentication using Azure Active Directory

This template is preconfigured to authenticate using Azure AD.

To disable this authentication, remove static/staticwebapp.config.json file.

Nothing fits, I need it in my way

You basically only need to run yarn build command that creates build folder. Content of the folder needs to be placed to folder where index file is expected (eg. a document root folder of a webserver).