DEV Community

Ryan Febriansyah
Ryan Febriansyah

Posted on

Github Actions for Documentation

My Workflow

it was my first time using github actions to deploy my project documentation automatically. Previously, deployment for documentation itself was done "conventionally" and the exists of github actions is arguably very helpful for me. For the example itself, it will be deploying for Mkdocs site to github pages.

Submission Category

DIY Deployments

Yaml File or Link to Code

This is what my configuration looks like

name: Build
on:
  push:
    branches: master

jobs:
  build:
    name: Deploy docs
    runs-on: ubuntu-latest
    steps:
      - name: Checkout master
        uses: actions/checkout@v1

      - name: Deploy docs
        uses: mhausenblas/mkdocs-deploy-gh-pages@1.11
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

The configuration itself it's pretty simple, but there are two ways for generating and building your documentation into github pages. The first way is to use a PERSONAL_TOKEN that we can create a secret key in the our repository, and the second way is to use GITHUB_TOKEN that automatically generated by github actions when a workflow runs so it's pretty convenient.

However, it's highly recommended to use a PERSONAL_TOKEN because it's safer rather than use GITHUB_TOKEN.

Additional Resources / Info

This is the link for my github actions repository :

https://github.com/sodrooome/pure-datastructures

Please let me know if you have any feedback or if you want me to add new features! Thank you!

Top comments (0)