Skip to content

Add React build process for full-stack deployment #3

Add React build process for full-stack deployment

Add React build process for full-stack deployment #3

name: Staging Deployment
on:
push:
pull_request:
jobs:
build-and-deploy:
name: Build and Deploy to Staging
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16' # Specify Node.js version
- name: Install dependencies
run: npm install
- name: Build the application
run: npm run build
- name: Deploy to Staging
if: github.event_name == 'push' # Deploy only on direct pushes, not pull requests
env:
STAGING_API_KEY: ${{ secrets.STAGING_API_KEY }}
STAGING_API_URL: ${{ secrets.STAGING_API_URL }}
run: |
# Replace with your deployment command or script
curl -X POST -H "Authorization: Bearer $STAGING_API_KEY" -d @dist/index.js $STAGING_API_URL