From 96b28b7d5f913e6e7bee08e44244b5a9c217a0e4 Mon Sep 17 00:00:00 2001 From: bast Date: Sat, 31 Oct 2026 01:01:43 +0000 Subject: [PATCH] =?UTF-8?q?.github/workflows/deploy.yml=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit add wf --- .github/workflows/deploy.yml | 42 ++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..159c5d5 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,42 @@ +name: Build, Push and GitOps Deploy + +on: + push: + branches: [ "main" ] + workflow_dispatch: + +jobs: + test-and-deploy: + runs-on: ubuntu-latest + container: ghcr.io/devops-infra/docker-terraform:latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Log in to Local Registry + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login forgejo:3000 -u ${{ github.actor }} --password-stdin + + - name: Inject Version into Dockerfile + run: sed -i "s/{{APP_VERSION}}/${{ github.sha }}/g" Dockerfile + + - name: Build App Image + run: | + docker build -t forgejo:3000/${{ github.repository }}:${{ github.sha }} . + docker build -t forgejo:3000/${{ github.repository }}:latest . + + - name: Push App Image + run: | + docker push forgejo:3000/${{ github.repository }}:${{ github.sha }} + docker push forgejo:3000/${{ github.repository }}:latest + + - name: Terraform Deploy + run: | + terraform init + terraform apply -auto-approve -var="app_version=${{ github.sha }}" + + - name: Verify App Health + run: | + echo "Warte auf das Ingress-Routing..." + sleep 15 + curl --fail --connect-timeout 5 http://local-k3s-platform:80/ || exit 1 + echo "Erfolg: Die App läuft fehlerfrei nach dem Update!"