docs: Github actions doesn't work, update to new bits
See original GitHub issueContribution guidelines
- I’ve read the contribution guidelines and wholeheartedly agree
I want to suggest an idea and checked that …
- … to my best knowledge, my idea wouldn’t break something for other users
- … the documentation does not mention anything about my idea
- … there are no open or closed issues that are related to my idea
Description
There Publish site with GH Action doesn’t seem to work any longer. There’s a chance it’s an error on my part but the mkdocs gh-deploy doesn’t seem to be compatible with GH any longer. Also checkout@v2
and setup-python@v2
need to be updated to v3 due to deprecation of nodejs 12 by GH.
https://squidfunk.github.io/mkdocs-material/publishing-your-site/#github-pages
I ended up rewriting the action to use the mkdocs build
command together with GH artefact upload and page deploy actions, based on the Jekyll example. Together with the new actions based publish setting for the repo under repo>settings>pages. Seems to work great. I’ve included my code below, feel free to use as basis for an updated example in docs.
Use Cases
Publish Material for MKdocs site to Github pages for hosting.
Screenshots / Mockups
name: Publish docs with Material for MKDocs
on:
pull_request:
branches:
- "main"
paths:
- "docs/**"
push:
branches:
- "main"
paths:
- "docs/**"
# 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:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Setup Python, install plugins, and build site
uses: actions/setup-python@v4
with:
python-version: 3.x
- run: pip install mkdocs-material mkdocs-minify-plugin pillow cairosvg
- run: mkdocs build --site-dir ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
Issue Analytics
- State:
- Created 10 months ago
- Comments:9 (4 by maintainers)
Ah, interesting. Please report this upstream then. We can and should switch to the newer actions nonetheless, and I believe that it’s possible to reduce the number of changes. You can take a look at our workflow, which also uses the latest versions.
Thanks for testing! You should use “deploy from branch” and select the correct branch in the menu below: