50 lines
1.0 KiB
YAML
50 lines
1.0 KiB
YAML
name: Frontend Deploy
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
paths:
|
|
- 'src/**'
|
|
- '.github/workflows/frontend-deploy.yml'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: .
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'npm'
|
|
cache-dependency-path: package-lock.json
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Run Linter
|
|
run: npm run lint --if-present
|
|
|
|
- name: Run Tests
|
|
run: npm test -- --watchAll=false
|
|
|
|
# Deployment (Waits for manual approval after 'test' passes)
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
needs: test
|
|
environment: production
|
|
|
|
steps:
|
|
- name: Trigger webhook using curl
|
|
env:
|
|
WEBHOOK_URL: ${{ secrets.AMPLIFY_WEBHOOK_URL }}
|
|
run: |
|
|
curl -i --fail -X POST -H "Content-Type: application/json" -d '{}' "$WEBHOOK_URL"
|