chore: update deploy production path (#197) #2
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: PRODUCTION - Deploy API | |
env: | |
HUSKY: 0 | |
on: | |
push: | |
tags: | |
- "*" | |
jobs: | |
build-api: | |
runs-on: ubuntu-latest | |
environment: | |
name: production | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1-node16 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Build, tag, and push image to Amazon ECR | |
env: | |
ECR_REGISTRY: ${{ secrets.AWS_ECR_REGISTRY }} | |
IMAGE_TAG: ${{ github.sha }} | |
run: | | |
docker build -f ./api.Dockerfile --build-arg VERSION=$IMAGE_TAG -t $ECR_REGISTRY:$IMAGE_TAG . | |
docker tag $ECR_REGISTRY:$IMAGE_TAG $ECR_REGISTRY:latest | |
docker push $ECR_REGISTRY:$IMAGE_TAG | |
docker push $ECR_REGISTRY:latest | |
- name: Install Selleo CLI | |
uses: jaxxstorm/[email protected] | |
with: | |
repo: selleo/cli | |
tag: v0.26.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: ECS Deployment | |
env: | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
ECS_CLUSTER: ${{ secrets.AWS_ECS_CLUSTER }} | |
ECS_SERVICE: ${{ secrets.AWS_ECS_SERVICE }} | |
DOCKER_IMAGE: ${{ secrets.AWS_ECR_REGISTRY }}:${{ github.sha }} | |
run: selleo aws ecs deploy --region $AWS_REGION --cluster $ECS_CLUSTER --service $ECS_SERVICE --docker-image $DOCKER_IMAGE --one-off migrate --one-off seed | |
- name: ECS Run migrations | |
env: | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
ECS_CLUSTER: ${{ secrets.AWS_ECS_CLUSTER }} | |
ECS_SERVICE: ${{ secrets.AWS_ECS_SERVICE }} | |
run: selleo aws ecs run --region $AWS_REGION --cluster $ECS_CLUSTER --service $ECS_SERVICE --one-off migrate | |
- name: ECS Run seeds | |
env: | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
ECS_CLUSTER: ${{ secrets.AWS_ECS_CLUSTER }} | |
ECS_SERVICE: ${{ secrets.AWS_ECS_SERVICE }} | |
run: selleo aws ecs run --region $AWS_REGION --cluster $ECS_CLUSTER --service $ECS_SERVICE --one-off seed |