Deploy content to production #417
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Deploy content to production" | |
on: workflow_dispatch | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout Source Code" | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- name: "Setup Node.js environment" | |
uses: actions/setup-node@v4.1.0 | |
with: | |
node-version-file: .nvmrc | |
- name: Caching Gatsby | |
id: gatsby-cache-build | |
uses: actions/cache@v4 | |
with: | |
path: | | |
public | |
.cache | |
key: ${{ runner.os }}-gatsby-build-${{ github.run_id }} | |
restore-keys: | | |
${{ runner.os }}-gatsby-build- | |
- name: Create .env file | |
uses: SpicyPizza/create-envfile@v2 | |
with: | |
envkey_GATSBY_API_DOMAIN: ${{ secrets.GATSBY_API_DOMAIN }} | |
envkey_GATSBY_GTM_ID: ${{ secrets.GATSBY_GTM_ID }} | |
envkey_KCVV_PSD_API: ${{ secrets.KCVV_PSD_API }} | |
envkey_TYPEKIT_ID: ${{ secrets.TYPEKIT_ID }} | |
- name: "Build the website (production build)" | |
run: | | |
yarn install --production | |
yarn run build | |
- name: "Deploy to netlify server" | |
uses: South-Paw/action-netlify-cli@v2 | |
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 |