chore(api): Reorganized import using path alias #11
This file contains 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 Web | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: ['apps/web/**', '.github/workflows/deploy-web.yml', 'package.json'] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: alpha | |
name: Build and push Web docker image for release | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.SECRET_KEY }} | |
aws-region: ap-south-1 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v2 | |
- name: Build Docker image | |
id: build | |
env: | |
ECR_REGISTRY: ${{ vars.ECR_REGISTRY }} | |
ECR_REPOSITORY: ${{ vars.ECR_WEB_REPOSITORY }} | |
run: | | |
# Build a docker container and push it to ECR | |
aws ecr get-login-password --region ap-south-1 | docker login --username AWS --password-stdin $ECR_REGISTRY | |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:${GITHUB_SHA::6} -t $ECR_REGISTRY/$ECR_REPOSITORY:latest -f ./apps/web/Dockerfile . | |
echo "Pushing image to ECR..." | |
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest | |
docker push $ECR_REGISTRY/$ECR_REPOSITORY:${GITHUB_SHA::6} | |
echo "name=image::$ECR_REGISTRY/$ECR_REPOSITORY:latest" >> $GITHUB_OUTPUT | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
environment: alpha | |
name: Deploy Web docker image for release | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.SECRET_KEY }} | |
aws-region: ap-south-1 | |
- name: Force re-deploy task in service | |
id: force-redeploy | |
env: | |
ECS_CLUSTER: ${{ vars.ECS_CLUSTER }} | |
ECS_SERVICE: ${{ vars.ECS_WEB_SERVICE }} | |
run: | | |
aws ecs update-service --cluster $ECS_CLUSTER --service $ECS_SERVICE --force-new-deployment |