Giter VIP home page Giter VIP logo

docusaurus-github-action's Introduction

Docusaurus GitHub Pages Action

A GitHub action to deploy your Docusaurus site to GitHub pages.

Usage

Build and deploy

The project uses repo deploy keys to push to GitHub pages rather than access tokens, so make sure to setup your deploy key in the repo and then add it as a Secret under DEPLOY_SSH_KEY. Also, you will need the ALGOLIA_API_KEY API key to have a functional search on the page.


Update versions

The project can update the version of the documentation using the package.json semantic version as its reference. This will only work with minor or patch updates for the first documentation versioning or in case of a major update you will need to perform this update manually. Here you can check the steps to do the manual version update.

Filter and install

We need to install the Docusaurus dependencies to process with the action; we use the npm install action to this purpose.

Also, we only activate the action when there is an update on the master branch. We use the filter action to check if the event that we target perform an update on master.


We use the args attribute to know which action we need to run as you can see on the main.workflow example.

workflow "Build Docs" {
  on = "push"
  resolves = ["Deploy Docs"]
}

action "Filter Master" {
  uses = "actions/bin/filter@master"
  args = "branch master"
}

action "Install" {
  needs = ["Filter branch"]
  uses = "actions/npm@master"
  args = "install --prefix ./website"
}

action "Update version" {
  needs = ["Install"]
  uses = "clay/docusaurus-github-action@master"
  args = "version"
}

action "Deploy Docs" {
  needs = ["Update version"]
  uses = "clay/docusaurus-github-action@master"
  args="deploy"
  secrets = ["DEPLOY_SSH_KEY", "ALGOLIA_API_KEY"]
  env={
      BUILD_DIR = "website",
      PROJECT_NAME = "clay"
  }
}

Environment Variables

There are two environment variables you can control:

  • BUILD_DIR: the directory your code Docusaurus config is in. Defaults to website.
  • PROJECT_NAME: should be set to the value of projectName in your Docusaurus siteConfig.js file. It determines the name of the directory which will be output in the build directory which is then deployed to the gh-pages branch. Defaults to site because it doesn't truly need to be set to the projects name.

docusaurus-github-action's People

Contributors

jonwinton avatar oscarpolanco avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docusaurus-github-action's Issues

Push to gh-pages

We want to maintain the site in the master branch but deploy it in the gh-pages branch. Any hints for that? Do you think it is possible?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.