Skip to content

0.21.0-PRERELEASE

0.21.0-PRERELEASE #35

Workflow file for this run

name: Deploy to Dev Environment
on:
release:
types: [prereleased]
env:
AWS_REGION: "us-west-2"
ECR_REPOSITORY: "aidingapp"
jobs:
deploy:
name: Deploy
runs-on: ubuntu-22.04
environment: staging
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
ref: ${{ github.head_ref }}
token: ${{ secrets.PAT }}
- name: Configure AWS credentials
# SHA of release v4.0.2
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502
with:
aws-access-key-id: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
# SHA of release v2.0.1
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076
- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.event.release.tag_name }}
run: |
# Build a docker container and
# push it to ECR so that it can
# be deployed to ECS.
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG --target deploy --platform linux/amd64 --build-arg USER_ID=9999 --build-arg GROUP_ID=9999 .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
# SHA of release v1.2.0
uses: aws-actions/amazon-ecs-render-task-definition@4225e0b507142a2e432b018bc3ccb728559b437a
with:
task-definition: "docker/devops/ecs/aidingapp/aidingapp-dev-task-definition.json"
container-name: "app"
image: ${{ steps.build-image.outputs.image }}
- name: Deploy Amazon ECS task definition
# SHA of release v1.4.11
uses: aws-actions/amazon-ecs-deploy-task-definition@df9643053eda01f169e64a0e60233aacca83799a
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: "aidingapp-dev-service"
cluster: "aidingapp-dev"
wait-for-service-stability: true