Skip to content

devops: GitHub Actions deployment workflow #1

devops: GitHub Actions deployment workflow

devops: GitHub Actions deployment workflow #1

Workflow file for this run

name: Netlify Deployment
on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Install dependencies
run: npm install
- name: Build project
run: npm run build
- name: Deploy to Netlify
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
run: |
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
SITE_ID=${{ secrets.NETLIFY_SITE_ID_MAIN }}
elif [ "${{ github.ref }}" == "refs/heads/dev" ]; then
SITE_ID=${{ secrets.NETLIFY_SITE_ID_DEV }}
else
echo "Branch not configured for deployment"
exit 1
fi
npm install -g netlify-cli
netlify deploy --prod --dir=dist --site=$SITE_ID --auth=$NETLIFY_AUTH_TOKEN