try fix github action #7
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 | |
# this is used by github OIDC to assume the admin role later on | |
permissions: # see this: https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs | |
id-token: write # This is required for requesting the JWT | |
contents: write # This is required for actions/checkout | |
packages: write # This is required for pushing to the container registry | |
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@v1 | |
with: | |
role-to-assume: ${{ secrets.AWS_IMMUTABLE_PROD_ADMIN_ROLE }} | |
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 |