diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 1235b9a3..b86ba20e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -11,8 +11,28 @@ env: REGISTRY: ghcr.io/gsa-tts/atj-platform jobs: - init-deploy: + build-image: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Build container image + run: docker build . --platform linux/amd64 --target doj-demo --tag ${REGISTRY}/doj-demo:${TAG_NAME} + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Publish to container registry + run: docker push ${REGISTRY}/doj-demo:${TAG_NAME} + + deploy: runs-on: ubuntu-latest + needs: [build-image] steps: - name: Checkout repository uses: actions/checkout@v3 @@ -33,6 +53,7 @@ jobs: with: version: 8 run_install: false + - name: Get pnpm store directory id: pnpm-cache shell: bash @@ -50,34 +71,12 @@ jobs: - name: Install dependencies run: pnpm install - build-image: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Build container image - run: docker build . --platform linux/amd64 --target doj-demo --tag ${REGISTRY}/doj-demo:${TAG_NAME} - - - name: Log in to the Container registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Publish to container registry - run: docker push ${REGISTRY}/doj-demo:${TAG_NAME} - - deploy: - runs-on: ubuntu-latest - needs: [build-image, init-deploy] - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - name: Initialize Terraform CDK configuration - run: pnpm build + shell: bash + run: | + cd infra + pnpm cdktf get + pnpm build:tsc - name: Apply Terraform CDK configuration - run: pnpm cdktf deploy + run: pnpm cdktf deploy --auto-approve