Skip to content

Deploy to test

Deploy to test #318

name: 'Deploy to test'
on:
workflow_dispatch:
env:
AWS_REGION: us-east-1
permissions:
id-token: write
contents: read
jobs:
deploy:
name: Deploy to Test
runs-on: ubuntu-latest
environment:
name: test
steps:
- name: configure 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: ${{ env.AWS_REGION }}
role-session-name: github_to_aws_deploy
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Pull, tag and push docker images ECR
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG_PULL: ${{ secrets.IMAGE_TAG_PULL }}
IMAGE_TAG: ${{ secrets.IMAGE_TAG }}
CLUSTER: ${{ secrets.CLUSTER }}
TARGET_SERVICE: ${{ secrets.TARGET_SERVICE }}
TARGET_SERVICE_B: ${{ secrets.TARGET_SERVICE_B }}
run: |
docker pull $REGISTRY/concordia:$IMAGE_TAG_PULL
docker pull $REGISTRY/concordia/importer:$IMAGE_TAG_PULL
docker pull $REGISTRY/concordia/celerybeat:$IMAGE_TAG_PULL
docker tag $REGISTRY/concordia:$IMAGE_TAG_PULL $REGISTRY/concordia:$IMAGE_TAG
docker tag $REGISTRY/concordia/importer:$IMAGE_TAG_PULL $REGISTRY/concordia/importer:$IMAGE_TAG
docker tag $REGISTRY/concordia/celerybeat:$IMAGE_TAG_PULL $REGISTRY/concordia/celerybeat:$IMAGE_TAG
docker push $REGISTRY/concordia:$IMAGE_TAG
docker push $REGISTRY/concordia/importer:$IMAGE_TAG
docker push $REGISTRY/concordia/celerybeat:$IMAGE_TAG
aws ecs update-service --region ${{ env.AWS_REGION }} --force-new-deployment --cluster $CLUSTER --service $TARGET_SERVICE
aws ecs update-service --region ${{ env.AWS_REGION }} --force-new-deployment --cluster $CLUSTER --service $TARGET_SERVICE_B