Final Emai Testing #31
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | name: Deploy Frontend | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'static/index.html' | |
| - 'static/styles.css' | |
| - 'static/scripts.js' | |
| - 'favicon.ico' | |
| - '.github/workflows/frontend-deploy.yml' | |
| jobs: | |
| deploy: | |
| name: Deploy to S3 and Invalidate CloudFront | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Configure AWS credentials | |
| 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: us-east-1 | |
| - name: Deploy static files to S3 | |
| run: | | |
| aws s3 sync ./static/ s3://${{ secrets.S3_BUCKET_NAME }} \ | |
| --exclude ".git/*" \ | |
| --exclude ".github/*" \ | |
| --exclude "backend/*" \ | |
| --exclude "README.md" \ | |
| --delete | |
| - name: Invalidate CloudFront distribution | |
| run: | | |
| aws cloudfront create-invalidation \ | |
| --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} \ | |
| --paths "/*" |