Deploying Statiq Web to GitHub Pages

Published on Thursday, 15 September 2022 by Russ Cam

I finally got around to porting this blog over to a static website. After several years running on Orchard, followed by many more on MiniBlog, I'd been looking for a simpler experience for some time, in the hope that a simpler experience would encourage me to blog more. I came across Wyam a while back, and followed its evolution into Statiq Web, and finally took the time to port things over.

When it came to running it on GitHub Pages, it seemed like some things had changed on GitHub pages in deploying with GitHub actions, compared to the steps described in the docs. Specifically, I was getting rate limit exceeded exceptions, and secondary rate limit exceptions that looked to actually be forbidden exceptions. Here's a chronicle of the steps I took to get everything running smoothly.

First up, I went to Settings > Pages in the GitHub repository, and chose GitHub actions as the Build and deployment source

GitHub Pages deployment source

This stops the default classic GitHub pages experience from using a default pages build and deployment workflow to try to build and deploy your site.

Next up, I configured a GitHub actions workflow to build and deploy the Statiq Web app, committing the following workflow yml file to the repository at .github/workflows/publish.yml

name: Statiq Web Deploy

# Controls when the workflow will run
  # Triggers the workflow on push but only for the "main" branch
    branches: [ "main" ]

  # Allows you to run this workflow manually from the Actions tab

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages    
  contents: read
  pages: write
  id-token: write

# Allow one concurrent deployment
  group: "pages"
  cancel-in-progress: true

      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest

      - name: Checkout  
        uses: actions/checkout@v3
      - name: Setup GitHub Pages
        uses: actions/configure-pages@v2  

      - name: Setup .NET Core
        uses: actions/setup-dotnet@v1
          dotnet-version: ${{ env.DOTNET_VERSION }}

      - name: Build Website
        run: dotnet run

      - name: Upload artifact
        uses: actions/upload-pages-artifact@v1
          # Upload output only
          path: './output'
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v1

Upon pushing to the main branch, everything built and was uploaded successfully to GitHub pages :)


comments powered by Disqus