0.11.0 #12
Workflow file for this run
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: cd | |
on: | |
push: | |
tags: | |
- 'v**' | |
jobs: | |
aws: | |
name: AWS | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Configure AWS Credentials using Secrets | |
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-session-token: ${{ secrets.AWS_SESSION_TOKEN }} | |
aws-region: us-east-1 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Build and push to Amazon ECR | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
ECR_REPO: fragments | |
VERSION_TAG: ${{ github.ref_name }} | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPO }}:${{ env.VERSION_TAG }}, ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPO }}:latest | |
- name: Fill in the new image ID in the Amazon ECS task definition | |
id: update-task-def | |
uses: aws-actions/amazon-ecs-render-task-definition@v1 | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
ECR_REPO: fragments | |
VERSION_TAG: ${{ github.ref_name }} | |
with: | |
task-definition: fragments-definition.json | |
container-name: fragments | |
image: ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPO }}:${{ env.VERSION_TAG }} | |
environment-variables: | | |
LOG_LEVEL=info | |
NODE_ENV=production | |
AWS_COGNITO_CLIENT_ID=${{ secrets.AWS_COGNITO_CLIENT_ID }} | |
AWS_COGNITO_POOL_ID=${{ secrets.AWS_COGNITO_POOL_ID }} | |
AWS_REGION=${{ secrets.AWS_REGION }} | |
PORT=${{ secrets.PORT }} | |
API_URL=${{ secrets.API_URL }} | |
AWS_S3_BUCKET_NAME=${{ secrets.AWS_S3_BUCKET_NAME }} | |
AWS_DYNAMODB_TABLE_NAME={{ secrets.AWS_DYNAMODB_TABLE_NAME }} | |
- name: Deploy Amazon ECS task definition | |
uses: aws-actions/amazon-ecs-deploy-task-definition@v1 | |
with: | |
task-definition: ${{ steps.update-task-def.outputs.task-definition }} | |
cluster: fragments-cluster | |
service: fragments-service | |
wait-for-service-stability: true |