Skip to content

chore(app): migrate to yarn 4 (#61) #33

chore(app): migrate to yarn 4 (#61)

chore(app): migrate to yarn 4 (#61) #33

Workflow file for this run

name: Deploy Core Backend
on:
push:
branches:
- main
- dev
paths:
- 'apps/core/src/**'
- 'apps/core/Dockerfile'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
jobs:
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Copy the core Dockerfile in the root repository
run: cp apps/core/Dockerfile .
- name: Build, tag, and push docker image to Amazon ECR
env:
REGISTRY: public.ecr.aws/x9y5g9l2
REGION: us-east-1 # Public ECR aren't region specific
REPOSITORY: ${{ (github.ref == 'refs/heads/main' && 'snipcode') || 'snipcode-dev' }}
IMAGE_TAG: latest
run: |
aws ecr-public get-login-password --region $REGION | docker login --username AWS --password-stdin $REGISTRY
docker build -t $REPOSITORY:$IMAGE_TAG .
docker tag $REPOSITORY:$IMAGE_TAG $REGISTRY/$REPOSITORY:$IMAGE_TAG
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG
deploy:
runs-on: ubuntu-latest
environment: ${{ (github.ref == 'refs/heads/main' && 'Production') || 'Development' }}
needs:
- package
steps:
- uses: actions/checkout@v4
- name: Deploy the application
env:
AWS_REGION: eu-west-1
run: |
touch file.json && echo '${{ secrets.CORE_APP_ARN }}' > file.json
aws apprunner start-deployment --region $AWS_REGION --cli-input-json file://file.json