From 568f5d14f6e3a5fd96e029a9a0ee52ff2262e8c7 Mon Sep 17 00:00:00 2001 From: Daniel Naab Date: Mon, 11 Mar 2024 11:45:10 -0500 Subject: [PATCH] Simplify - hopefully - the Terraform deploy Github action (#66) --- .github/workflows/deploy.yml | 57 ++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 29 deletions(-) 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