Merge pull request #277 from inbo/dec-rel3 #59
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 UAT | |
on: | |
push: | |
branches: | |
- development | |
jobs: | |
deploy: | |
runs-on: self-hosted | |
environment: UAT | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | |
role-to-assume: ${{ secrets.AWS_ECR_DEPLOYMENT_ROLE }} | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v2 | |
- name: BACK-END - Build, tag, and push docker image to Amazon ECR | |
env: | |
REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
REPOSITORY: ${{ secrets.AWS_ECR_REPO_BACKEND }} | |
IMAGE_TAG: uat | |
run: | | |
docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG -f Dockerfile.backend . | |
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG | |
- name: FRONT-END - Build, tag, and push docker image to Amazon ECR | |
env: | |
REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
REPOSITORY: ${{ secrets.AWS_ECR_REPO_FRONTEND }} | |
IMAGE_TAG: uat | |
run: | | |
docker build --build-arg ${{ secrets.FRONTEND_DOCKER_BUILD_ARGS }} -t $REGISTRY/$REPOSITORY:$IMAGE_TAG -f Dockerfile.frontend . | |
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG | |
- name: Setup AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | |
role-to-assume: ${{ secrets.AWS_DEPLOYMENT_ROLE }} | |
- name: Deploy new backend task | |
run: | | |
aws ecs update-service --cluster ${{ secrets.AWS_ECS_CLUSTER }} --service ${{ secrets.AWS_ECS_DJANGO_SERVICE }} --force-new-deployment | |
- name: Deploy new backend task | |
run: | | |
aws ecs update-service --cluster ${{ secrets.AWS_ECS_CLUSTER }} --service ${{ secrets.AWS_ECS_NODE_SERVICE }} --force-new-deployment |