mhausenblas / mkdocs-deploy-gh-pages

GitHub Action to deploy an MkDocs site to GitHub Pages
Apache License 2.0
244 stars 90 forks source link

make install plugin configurable #248

Closed rterror closed 11 months ago

rterror commented 11 months ago

Thank you so much for your Dockerfile. But I run into some problems when I use some plugins in my material project, such as meta-manager, glightbox. I wonder if you can port some configurable parameters that allow users to pass the plugins to install.

rondemena commented 11 months ago

@rterror the actions.sh script prescriptively serves that purpose.

According to the README.md,

It allows you to define 'REQUIREMENTS:' in the action.yml file.

In order for it to operate you need to also include in the action.yml the 'CONFIG_FILE:' to reference the mkdocs.yml file of your configuration which should also references to those plugins. Assuming I traced them back, they are the following in proper reference:

  1. mkdocs-glightbox
  2. mkdocs-meta-manager

Only after both configuration details are included will the container compose the static site and deploy it as expected. I did not see any need for 'EXTRA_PACKAGES:' with these two plugins. However, if you have other plugins, be cautious to include again both the 'REQUIREMENTS:' and the mkdocs.yml updates in your template. An important detail is to also ensure you use consistent white spacing to prevent issues in these documents.

rterror commented 11 months ago

It works for me and thank you so much. @rondemena I create an requirements.txt in root directory of Material project and add two dependencies

mkdocs-meta-manager==0.2.1
mkdocs-glightbox==0.3.4

As to my github action workflow yml file, I add last two line of configurations:

name: Publish docs via GitHub Pages
on:
  push:
    branches:
      - main
jobs:
  build:
    name: Deploy docs
    runs-on: ubuntu-latest
    steps:
      - name: Checkout main
        uses: actions/checkout@v2
      - name: Deploy docs
        uses: mhausenblas/mkdocs-deploy-gh-pages@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          EXTRA_PACKAGES: build-base
          REQUIREMENTS: requirements.txt
          CONFIG_FILE: mkdocs.yml

Finally, it works for my case.

mhausenblas commented 11 months ago

Thank you so much for your guidance @rondemena!