Deploying Wyam.io Blog to Netlify

I'm still learning wyam.io but so far it looks promising. The Blog recipe is about as simple as you can get for getting a site up and running so you can focus on just writing posts!

I've also heard lots of positive things about Netlify so I thought I would try and automate the deployment of this Blog.

Probably the easiest GitHub Action ever!

Wyam give an example of deploying to Netlify using a Cake script, but that felt like a little overkill for my needs so I thought I would have a bash at using GitHub Actions to deploy my site when new commits happen in the master branch.

This is it, probably the least problematic CI pipeline I've ever setup!!

name: Wyam/Netlify

on:
  push:
    branches: [master]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - name: Setup .NET Core
        uses: actions/setup-dotnet@v1
        with:
          dotnet-version: 2.1.804
      - name: Install Wyam
        run: dotnet tool install -g Wyam.Tool
      - name: Build
        run: wyam build
      - name: Zip
        run: zip -r output output
      - name: Upload
        run: |
          curl --header "Content-Type: application/zip" \
            --header "Authorization: Bearer ${{ secrets.NETLIFY_TOKEN }}" \
            --data-binary "@output.zip" \
            https://api.netlify.com/api/v1/sites/redrabbits.netlify.com/deploys

You have to configure a Secret for your project containing your Netlify token and then good to go, using no more than dotnet and the native tools included in the ubuntu-latest image.

Happy Days!

//mrb0nj

Photo by Yancy Min on Unsplash

Comments