add github action to build and push to EKS #1
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: Deploy api | |
on: | |
push: | |
branches: | |
- main | |
- ts-backend | |
env: | |
AWS_REGION: us-east-2 | |
GITHUB_TOKEN: ${{ secrets.TS_IMMUTABLE_SDK_GITHUB_TOKEN }} | |
jobs: | |
build-deploy-api: | |
name: Build and Deploy API | |
runs-on: ubuntu-latest-4-cores | |
steps: | |
- name: configure aws credentials | |
id: aws-credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
fetch-depth: 0 | |
- name: setup | |
uses: ./.github/actions/setup | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ env.GITHUB_TOKEN }} | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ steps.aws-credentials.outputs.aws-account-id }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- uses: hmarr/debug-action@v3 | |
- name: build-image | |
run: | | |
yarn nx run api:deploy --configuration=ci |