Skip to content

Instantly share code, notes, and snippets.

@git2thehub
Created February 9, 2023 20:26
Show Gist options
  • Save git2thehub/274c10449b77ff54e376ec0aacd36678 to your computer and use it in GitHub Desktop.
Save git2thehub/274c10449b77ff54e376ec0aacd36678 to your computer and use it in GitHub Desktop.
yaml file for github netlify CI/CD
# push.yml
# Name of workflow
name: Push workflow
# When workflow is triggered
on:
push:
branches:
- dev
- main
# Jobs to carry out
jobs:
deploy:
# Operating system to run job on
runs-on: ubuntu-latest
# Steps in job
steps:
# Get code from repo
- name: Checkout code
uses: actions/checkout@v1
# Install NodeJS
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
# Run npm install and build on our code
- run: npm install
- run: npm run build --if-present
# Run Test
- name: Run tests
run: npm run test
# Deploy to Netlify using our production secrets
- 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:
args: deploy --dir=build --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