Skip to content

Instantly share code, notes, and snippets.

@dance2die
Created December 26, 2019 02:27
Show Gist options
  • Save dance2die/f8e95f917db03c6880acd5934cbb8cbd to your computer and use it in GitHub Desktop.
Save dance2die/f8e95f917db03c6880acd5934cbb8cbd to your computer and use it in GitHub Desktop.
Building Gatsby with GitHub Actions and deploying to Netlify
name: Build and Deploy to Gatsby every hour
on:
schedule:
- cron: '0 */2 * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
# https://github.com/actions/setup-node#usage
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- run: npm install
- run: npm run build
# Deploy the gatsby build to Netlify
- uses: netlify/actions/cli@master
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
with:
args: deploy --dir=public --prod
secrets: '["NETLIFY_AUTH_TOKEN", "NETLIFY_SITE_ID"]'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment