bottleneckcrm/.forgejo/workflows/deploy-frontend-production.yaml
vickytechkey e10f9829ee
All checks were successful
Deploy Beta (NATIVE) / deploy (push) Successful in 33s
Deploy Frontend Beta (S3) / deploy-frontend (push) Successful in 20s
Convert frontend to React JS and add S3 deployment workflows
2026-10-24 14:33:11 +05:30

39 lines
1.3 KiB
YAML

name: Deploy Frontend Production (S3)
on:
push:
branches:
- main
jobs:
deploy-frontend:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: https://github.com/actions/checkout@v4
- name: Install Dependencies and Build
env:
VITE_API_BASE_URL: https://apicsa.tradhox.com/api
run: |
cd frontend
npm ci
npm run build
- name: Deploy to AWS S3 & Invalidate CloudFront
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ap-south-2
S3_BUCKET: ${{ secrets.AWS_S3_BUCKET_PRODUCTION || 'csawebsite' }}
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID_PRODUCTION || 'E2G2C75ZGRMFVG' }}
run: |
apk add --no-cache aws-cli
if [ -z "$AWS_ACCESS_KEY_ID" ]; then
unset AWS_ACCESS_KEY_ID
unset AWS_SECRET_ACCESS_KEY
fi
aws s3 sync frontend/dist/ s3://${S3_BUCKET} --delete --region ap-south-2
if [ -n "$CLOUDFRONT_DISTRIBUTION_ID" ]; then
aws cloudfront create-invalidation --distribution-id ${CLOUDFRONT_DISTRIBUTION_ID} --paths "/*" --region ap-south-2
fi