Repository navigation
landingkit v0.38.0: the GitHub mark in the fork ribbon #32
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 + deploy the Hugo site to GitHub Pages on every push to main. | |
| # Adapted from the official Hugo template at | |
| # https://gohugo.io/host-and-deploy/host-on-github-pages/. | |
| name: Deploy Hugo site to Pages | |
| on: | |
| push: | |
| branches: [main] | |
| # Build on every pull request too, so a change to the layout, the content or | |
| # the Hugo version has to prove the site still builds before it lands. | |
| # Without this the workflow ran only on main, which meant a dependency bump | |
| # arrived with no signal at all -- its checks read "no checks", which is not | |
| # the same thing as green and must not be merged as if it were. | |
| pull_request: | |
| workflow_dispatch: | |
| # Allow only one concurrent deployment, skipping runs queued between | |
| # the run in-progress and latest queued. Don't cancel in-progress | |
| # runs — we want them to finish before a new build replaces them. | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| # The build needs nothing beyond the source and the Pages configuration it | |
| # reads to compute the base URL. Publishing rights are granted to the deploy | |
| # job alone, below, so a pull request build cannot replace what is served. | |
| permissions: | |
| contents: read | |
| pages: read | |
| env: | |
| # Pin Hugo so site builds don't break when a new release ships | |
| # incompatible template changes. Bump deliberately, not by | |
| # surprise. | |
| HUGO_VERSION: 0.135.0 | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Install Hugo CLI | |
| run: | | |
| wget -O hugo.deb "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb" | |
| sudo dpkg -i hugo.deb | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| submodules: recursive | |
| # Hugo resolves the landingkit module (hugo.toml [module]) with the go | |
| # command, at the version go.mod pins. | |
| - uses: actions/setup-go@v7 | |
| with: | |
| go-version-file: go.mod | |
| cache: false | |
| - name: Setup Pages | |
| id: pages | |
| uses: actions/configure-pages@v6 | |
| - name: Build | |
| env: | |
| HUGO_ENVIRONMENT: production | |
| HUGO_ENV: production | |
| run: | | |
| hugo \ | |
| --gc \ | |
| --minify \ | |
| --baseURL "${{ steps.pages.outputs.base_url }}/" | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v5 | |
| with: | |
| path: ./public | |
| deploy: | |
| # Only main publishes. A pull request stops after build above: it has built | |
| # the site and uploaded the artifact, which is the whole point of the gate, | |
| # and it has no business replacing what is served. | |
| if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| needs: build | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 |