Fix base URL in HTML validation step #113
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
| name: GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: true # Changed to true: cancels old builds if you push 2x quickly | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| build-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 # Updated to v5 | |
| with: | |
| submodules: recursive # 'recursive' is safer for themes | |
| fetch-depth: 0 | |
| - name: Setup Hugo | |
| uses: peaceiris/actions-hugo@v3 | |
| with: | |
| hugo-version: "0.154.5" # IMPORTANT: Match your Dev Container version | |
| extended: true | |
| - name: Setup Pages | |
| id: pages | |
| uses: actions/configure-pages@v4 # Updated to v4 | |
| # Optional: This speeds up builds by caching Hugo modules | |
| - name: Cache Hugo modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: /tmp/hugo_cache | |
| key: ${{ runner.os }}-hugo-${{ hashFiles('**/go.sum') }} | |
| restore-keys: | | |
| ${{ runner.os }}-hugo- | |
| - name: Build | |
| env: | |
| HUGO_ENVIRONMENT: production | |
| HUGO_ENV: production | |
| run: | | |
| hugo \ | |
| --gc \ | |
| --minify \ | |
| --baseURL "${{ steps.pages.outputs.base_url }}/" | |
| - name: Validate HTML | |
| run: | | |
| wget --spider -r -nd -nv -l 5 "${{ steps.pages.outputs.base_url }}" | |
| # Optionally, you could use tools like html-proofer for more control. | |
| - name: Deploy | |
| uses: peaceiris/actions-gh-pages@v3 # This one is still v3 (stable) | |
| if: ${{ github.ref == 'refs/heads/master' }} | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_branch: gh-pages | |
| publish_dir: ./public |