trying something with lychee #434
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Build site for commits pushed to all branches | |
| # Deploy only if on default branch | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.9.x' # same as macOS | |
| cache: pip | |
| - name: Install dependencies | |
| run: pip install -r requirements.txt | |
| - name: Build site | |
| run: mkdocs build | |
| - name: Upload site/ | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: site | |
| link-checker: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| permissions: | |
| actions: read | |
| steps: | |
| # Cache lychee external URL results for 30 days | |
| - name: Download site | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: github-pages | |
| - run: tar -xf artifact.tar && rm artifact.tar | |
| # https://github.com/lycheeverse/lychee-action#utilising-the-cache-feature | |
| - name: Restore lychee cache | |
| id: restore-cache | |
| uses: actions/cache/restore@v3 | |
| with: | |
| path: .lycheecache | |
| key: cache-lychee-${{ github.sha }} | |
| restore-keys: cache-lychee- | |
| - name: Run lychee | |
| uses: lycheeverse/[email protected] | |
| with: | |
| args: "--base . --cache --config lychee.toml -- './**/*.html' './**/*.css'" | |
| fail: true | |
| - name: Save lychee cache | |
| uses: actions/cache/save@v3 | |
| if: always() | |
| with: | |
| path: .lycheecache | |
| key: ${{ steps.restore-cache.outputs.cache-primary-key }} | |
| deploy: | |
| if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch) | |
| runs-on: ubuntu-latest | |
| needs: build | |
| permissions: | |
| pages: write | |
| id-token: write | |
| actions: read | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |