Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/push-artifacts.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Build artifacts and push to S3
name: Publish to S3
on:
push:
branches:
- main
jobs:
deploy:
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
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding error handling and validation before the S3 sync operation. The build could succeed but produce an empty or invalid dist directory, which would then sync to S3.

Suggested change
run: yarn build
run: yarn build
- name: Validate dist directory
run: |
if [ ! -d "./dist" ] || [ -z "$(ls -A ./dist)" ]; then
echo "Error: dist directory does not exist or is empty. Aborting deployment."
exit 1
fi

Copilot uses AI. Check for mistakes.
- name: Deploy to S3
run: |
aws s3 sync ./dist s3://${{ secrets.AWS_S3_BUCKET }} --delete
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The --delete flag will remove files from S3 that don't exist locally, which could lead to unintended data loss. Consider adding error handling or removing this flag if not necessary for the deployment strategy.

Suggested change
aws s3 sync ./dist s3://${{ secrets.AWS_S3_BUCKET }} --delete
aws s3 sync ./dist s3://${{ secrets.AWS_S3_BUCKET }}

Copilot uses AI. Check for mistakes.