Skip to content

Update deploy-backend.yml #33

Update deploy-backend.yml

Update deploy-backend.yml #33

Workflow file for this run

name: Deploy Frontend to S3
on:
push:
branches:
- main
- frontend # Adjust this if you want to deploy from a different branch.
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build Docker image
run: |
docker build -t frontend-build -f frontend/Dockerfile .
- name: Extract built files
run: |
mkdir -p frontend-build
docker run --rm -v $(pwd)/frontend-build:/output frontend-build cp -r /usr/share/nginx/html/* /output
- name: Configure AWS CLI
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: ap-south-1 # e.g., us-east-1
- name: Upload to S3
run: |
aws s3 sync frontend-build s3://electramart-bucket --delete
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ap-south-1 # e.g., us-east-1