Skip to content

Commit

Permalink
Simplify - hopefully - the Terraform deploy Github action (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielnaab authored Mar 11, 2024
1 parent cfbd16b commit 568f5d1
Showing 1 changed file with 28 additions and 29 deletions.
57 changes: 28 additions & 29 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -33,6 +53,7 @@ jobs:
with:
version: 8
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
Expand All @@ -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

0 comments on commit 568f5d1

Please sign in to comment.