-
Notifications
You must be signed in to change notification settings - Fork 2
41 lines (38 loc) · 1.24 KB
/
to-netlify.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
name: 'Gatsby Build and publish to Netlify'
on:
# 1. Trigger the workflow push on main branch
push:
branches:
- main-site-gatsby
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
tags:
description: 'Publish to Netlify'
jobs:
deploy:
name: 'Deploy'
# 2. Using the latest Ubuntu image
runs-on: ubuntu-latest
steps:
# Check out the current repository code
- uses: actions/checkout@v3
# 3. https://github.com/actions/setup-node#usage
- name: Setup node and build Gatsby
uses: actions/setup-node@v3
with:
node-version: '16.x'
cache: 'npm'
- run: npm install
# This triggers `gatsby build` script in "package.json"
- run: npm run build
# 4. Deploy the gatsby build to Netlify
- name: Deploy to netlify
uses: netlify/actions/cli@master
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
with:
# 5. "gatsby build" creates "public" folder, which is what we are deploying
args: deploy --dir=public --prod
secrets: '["NETLIFY_AUTH_TOKEN", "NETLIFY_SITE_ID"]'