Eben Gilkenson

Build and Deploy Gatsby with GitHub Actions

You can pretty easily host a small site for free with a service like Netlify, but if you already have your own server set up somewhere and are jealous of those push-to-deploy features, you can roll your own with GitHub Actions.

This is the very simple workflow that I set up to deploy this blog.

name: Build Gatsby Site

on: push
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
      - name: Build Gatsby Site
        uses: jzweifel/gatsby-cli-github-action@master
        with:
          gatsby-arg: build
      - name: FTP-Deploy-Action
        uses: SamKirkland/[email protected]
        env:
          FTP_SERVER: yourftpdomain.com
          FTP_USERNAME: ftp_username
          # set secrets under settings > secrets
          # in your repository
          FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }}
          # just upload the build folder
          LOCAL_DIR: public
          # delete orphaned files
          ARGS: --delete
← Learning Gatsby