name: pages on: push: branches: - main paths: - "docs/**" - ".github/workflows/pages.yml" - "mkdocs-base.yml" #schedule: # - cron: "50 * * * *" # Allows you to run this workflow manually from the Actions tab workflow_dispatch: # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: contents: write pages: write id-token: write concurrency: group: "pages" cancel-in-progress: true jobs: pages-build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v3 with: # Need full history for the last change date to work # correctly in mkdocs fetch-depth: 0 - name: Install gelatyx uses: baptiste0928/cargo-install@v2 with: crate: gelatyx - name: Install mdbook-linkcheck uses: baptiste0928/cargo-install@v2 with: crate: mdbook-linkcheck - uses: actions/setup-python@v4 with: python-version: 3.x - uses: actions/cache@v3 with: key: ${{ github.ref }} path: .cache - name: Build env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: CARDS=true ./docs/build.sh - name: Upload artifact uses: actions/upload-pages-artifact@v1 with: path: gh_pages - name: Check for modified files id: git-check run: | echo "modified=$(if git diff-index --quiet HEAD --; then echo 'false'; else echo 'true'; fi)" >> $GITHUB_OUTPUT - name: Push changes id: git-push if: steps.git-check.outputs.modified == 'true' run: | AUTHOR=$(git show -s --format='%aN') EMAIL=$(git show -s --format='%aE') git config --global user.name "${AUTHOR}" git config --global user.email "${EMAIL}" git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} git commit -am "Automated doc formatting fix" echo "hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT git push - name: Create commit comment if: steps.git-check.outputs.modified == 'true' uses: peter-evans/commit-comment@v2 with: body: | This commit had uncommitted doc formatting changes. These have been automatically applied in ${{ steps.git-push.outputs.hash }} pages-deploy: environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest needs: pages-build steps: - name: Deploy id: deployment uses: actions/deploy-pages@v1