Skip to content

Deploy to AWS S3

Deploy to AWS S3 #4

Workflow file for this run

name: Deploy to AWS S3
on:
workflow_dispatch:
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository
- name: Checkout code
uses: actions/checkout@v3
# Step 2: Set up Node.js
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '14' # Specify your Node.js version
# Step 3: Install dependencies
- name: Install dependencies
run: npm install
# Step 4: Build the project
- name: Build the project
run: npm run build
# Step 5: Configure AWS credentials
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: 'us-east-2' # Replace with your desired region
# Step 6: Sync built files to S3 bucket
- name: Sync files to S3
run: |
aws s3 sync ./build/ s3://${{ secrets.AWS_S3_BUCKET }}/ --delete
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}