Skip to content

Merge pull request #27 from Sans-arch/features #44

Merge pull request #27 from Sans-arch/features

Merge pull request #27 from Sans-arch/features #44

Workflow file for this run

name: Development CI/CD - Build and Deploy React App to CloudFront
on:
push:
branches: [main]
jobs:
pipeline:
name: Deploy to S3
runs-on: ubuntu-latest
env:
VITE_BACKEND_API: https://api-gamehub.techsan.dev/api
BUCKET: gamehub-frontend
DIST: dist
REGION: us-east-1
DIST_ID: E31X9W3PLVO8RY
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install
- name: Run Tests
run: npm run test
- name: Build static content
run: npm run build
- name: Configure AWS crdentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.REGION }}
- name: Copy files to the production website with the AWS CLI
run: |
aws s3 sync --delete ${{ env.DIST }} s3://${{ env.BUCKET }}
- name: Copy files to the production website with the AWS CLI
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ env.DIST_ID }} \
--paths "/*"