.github/workflows/deploy.yml hinzugefügt
Some checks are pending
Build, Push and GitOps Deploy / test-and-deploy (push) Waiting to run
Some checks are pending
Build, Push and GitOps Deploy / test-and-deploy (push) Waiting to run
add wf
This commit is contained in:
commit
96b28b7d5f
1 changed files with 42 additions and 0 deletions
42
.github/workflows/deploy.yml
vendored
Normal file
42
.github/workflows/deploy.yml
vendored
Normal file
|
|
@ -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!"
|
||||
Loading…
Reference in a new issue