Fix all feedback from Reddit #67
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 the site to AWS | |
| on: | |
| push: | |
| branches: ["main"] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Add Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.x | |
| cache: "npm" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build production site | |
| run: npm run build | |
| - name: Send assets to S3 and invalidate old cloudfront distribution | |
| uses: reggionick/s3-deploy@v3 | |
| with: | |
| folder: dist | |
| bucket: ${{ secrets.AWS_BUCKET_NAME }} | |
| bucket-region: ${{ secrets.AWS_BUCKET_REGION }} | |
| dist-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} | |
| - name: Notify | |
| uses: 8398a7/action-slack@v3 | |
| with: | |
| status: ${{ job.status }} | |
| fields: repo,message,commit,action,eventName,ref,workflow,job,took | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| if: always() |