Skip to content

feat: video lesson (#311) #162

feat: video lesson (#311)

feat: video lesson (#311) #162

name: STAGING - Deploy API
env:
HUSKY: 0
on:
push:
branches:
- main
- "deploy-staging/**"
paths:
- apps/api/**
- .github/workflows/deploy-api-staging.yml
jobs:
build-api:
runs-on: ubuntu-latest
environment:
name: staging
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: ${{ vars.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: ${{ vars.AWS_REGION }}
ECS_CLUSTER: ${{ vars.AWS_ECS_CLUSTER }}
ECS_SERVICE: ${{ vars.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: ${{ vars.AWS_REGION }}
ECS_CLUSTER: ${{ vars.AWS_ECS_CLUSTER }}
ECS_SERVICE: ${{ vars.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: ${{ vars.AWS_REGION }}
ECS_CLUSTER: ${{ vars.AWS_ECS_CLUSTER }}
ECS_SERVICE: ${{ vars.AWS_ECS_SERVICE }}
run: selleo aws ecs run --region $AWS_REGION --cluster $ECS_CLUSTER --service $ECS_SERVICE --one-off seed