Merge pull request #37 from Perry2004/chore/change-gha-job-names #3
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
| # Build artifacts and push to S3 | |
| name: Publish to S3 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| push-artifacts-to-s3: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Configure AWS Credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: ${{ secrets.AWS_IAM_ROLE_ARN }} | |
| aws-region: ${{ secrets.AWS_REGION }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| cache: "yarn" | |
| - name: Install Dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Build Project | |
| run: yarn build | |
| - name: Deploy to S3 | |
| run: | | |
| aws s3 sync ./dist s3://${{ secrets.AWS_S3_BUCKET }} --delete | |
| - name: Invalidate CloudFront cache | |
| uses: foxdalas/cloudfront-invalidator@v4 | |
| with: | |
| tag_key: "Name" | |
| tag_value: ${{ secrets.CLOUDFRONT_DISTRIBUTION_NAME }} | |
| paths: "/*" |