question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

docs: Github actions doesn't work, update to new bits

See original GitHub issue

Contribution guidelines

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:closed
  • Created 10 months ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
squidfunkcommented, Nov 25, 2022

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.

0reactions
squidfunkcommented, Nov 25, 2022

Thanks for testing! You should use “deploy from branch” and select the correct branch in the menu below:

Bildschirmfoto 2022-11-25 um 15 40 29
Read more comments on GitHub >

github_iconTop Results From Across the Web

Events that trigger workflows - GitHub Enterprise Cloud Docs
To trigger workflows by different activity types, use the types keyword. For more information, see "Workflow syntax for GitHub Actions." Note: Workflows will...
Read more >
GitHub Actions Refs Error · Issue #60 · jimporter/mike
I have a GH Action name: Site Deployment on: push: branches: - docs jobs: build: name: Deploy runs-on: ubuntu-latest steps: - name: Checkout ......
Read more >
Workflow level env does not work properly in all fields. #480
When using workflow level environment variables they do not work when I use them to substitute for jobs.build.name or jobs.build.runs-on .
Read more >
Manually running a workflow - GitHub Docs
On GitHub.com, navigate to the main page of the repository. · Under your repository name, click Actions. · In the left sidebar, click...
Read more >
Please support something like "allow-failure" for a given job
We use github actions in our "snapd" project and we love them. ... jobs: spread: runs-on: ubuntu-latest allow-failure: true steps: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found