Skip to content

Instantly share code, notes, and snippets.

@gyorgygutai
Created February 7, 2020 09:00
Show Gist options
  • Save gyorgygutai/ac95ab8219ca0dbcb23a7b7d0ed3ea22 to your computer and use it in GitHub Desktop.
Save gyorgygutai/ac95ab8219ca0dbcb23a7b7d0ed3ea22 to your computer and use it in GitHub Desktop.
Gatsby github actions deploy pipeline
name: Deploy to Netlify Hosting
on:
push:
branches:
- master
schedule:
- cron: '0,35 23 * * *'
repository_dispatch:
types: [build-deploy, dispatch]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install deps
run: yarn --frozen-lockfile
- name: Cache ./public
id: cache-folder-public
uses: actions/cache@v1
with:
path: public
key: v4-${{ runner.os }}-public-${{ github.sha }}
restore-keys: |
v4-${{ runner.os }}-public-
- name: Cache ./.cache
id: cache-folder-cache
uses: actions/cache@v1
with:
path: .cache
key: v4-${{ runner.os }}-cache-${{ github.sha }}
restore-keys: |
v4-${{ runner.os }}-cache-
- name: Build
run: GATSBY_CPU_COUNT=2 yarn build
- name: Netlify deploy
run: ./node_modules/.bin/netlify deploy --site ${{ secrets.NETLIFY_SITE_ID }} --auth ${{ secrets.NETLIFY_ACCESS_TOKEN }} --prod --dir=public
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment