Auto Deploy mkdocs with github actions.

May 08, 2023
MKdocs is a great way to write up your technical documentations, We recently caught up with mkdocs for documenting our startup's technical documentations. Thanks to avash for introducing me to this wonderful tool. 
However, My team had the dependency on me to manually build and deploy the documentation via scp to our documentation url. 
And Me being always busy with something else, Team was getting frustated.  So today I decided to implement auto deploy using github actions. I am relatively new to github actions as I used to be a jenkins fanboy. ( which I am still biased towards ). 
❯ cat .github/workflows/deploy.yml
name: Deploy mkdocs
    branches: [main]

    runs-on: ubuntu-latest
    - uses: actions/checkout@v2
    - uses: actions/setup-python@v2

    - name: Install requirements
      run: python3 -m pip install -r requirements.txt

    - name: Build
      run: mkdocs build

    - name: deploy
      uses: c0c1/scp-action@v1.0
        src: "site"
        host: "YOURHOST"
        remote: "DIR"
        port: "X"
        user: "deploy"
        key: ${{ secrets.SSH_KEY }}

Above is a simple tool to deploy mkdocs using github actions. 
However, for this to work , You would have to add in your secrets named SSH_KEY from your settings/secrets in github. 
With this no more bottleneck and dependency on me for the team to deploy their technical documentations 

❯ gh run view --job=13308049290

✓ main Deploy mkdocs · 4913474608
Triggered via push about 19 minutes ago

✓ deploy in 1m8s (ID 13308049290)
  ✓ Set up job
  ✓ Build c0c1/scp-action@v1.0
  ✓ Run actions/checkout@v2
  ✓ Run actions/setup-python@v2
  ✓ Install requirements
  ✓ Build
  ✓ deploy
  ✓ Post Run actions/setup-python@v2
  ✓ Post Run actions/checkout@v2
  ✓ Complete job

! Node.js 12 actions are deprecated. Please update the following actions to use Node.js 16: actions/checkout@v2, actions/setup-python@v2. For more information see:
deploy: .github#1

To see the full job log, try: gh run view --log --job=13308049290

There are still some deprication warnings though.  I'll pay heed to them in later date.