11name : Deploy to Staging Kubernetes
22
33on :
4- push :
4+ workflow_run :
5+ workflows : [Build Docker Images]
6+ types :
7+ - completed
58 branches :
69 - dev
10+ conclusion : success
711 pull_request :
812 branches :
913 - dev
1014
1115jobs :
12- generate_api_code :
16+ deployment :
1317 runs-on : ubuntu-latest
14- steps :
15- - name : Checkout code
16- uses : actions/checkout@v4
17-
18- - name : Setup Java
19- uses : actions/setup-java@v4
20- with :
21- java-version : ' 21'
22- distribution : ' temurin'
23-
24- - name : Setup Node.js
25- uses : actions/setup-node@v4
26- with :
27- node-version : ' 22'
28- cache : ' npm'
29-
30- - name : Setup Python
31- uses : actions/setup-python@v4
32- with :
33- python-version : ' 3.13'
34- cache : ' pip'
35-
36- - name : Install OpenAPI Generator
37- run : |
38- npm install -g @openapitools/openapi-generator-cli
39- pip install openapi-python-client
40-
41- - name : Generate Code
42- run : |
43- chmod +x api/scripts/gen-all.sh
44- ./api/scripts/gen-all.sh
45-
46- - name : Upload entire repository as artifact
47- uses : actions/upload-artifact@v4
48- with :
49- name : full-repository
50- path : .
51-
52- build_images :
53- runs-on : ubuntu-latest
54- needs : generate_api_code
55- strategy :
56- matrix :
57- service : [client, gateway, user-svc, concept-svc, genai-svc]
58- max-parallel : 1
59- steps :
60- - name : Download full repository artifact
61- uses : actions/download-artifact@v4
62- with :
63- name : full-repository
64- path : .
65-
66- - name : Log in to the Container registry
67- uses : docker/login-action@v3
68- with :
69- registry : ghcr.io
70- username : ${{ github.actor }}
71- password : ${{ secrets.GITHUB_TOKEN }}
72-
73- - name : Set up QEMU
74- uses : docker/setup-qemu-action@v3
75- with :
76- platforms : all
77-
78- - name : Install Docker Buildx
79- uses : docker/setup-buildx-action@v3
80-
81- - name : Extract metadata (tags, labels) for Docker
82- id : meta
83- uses : docker/metadata-action@v5
84- with :
85- images : ghcr.io/${{ github.repository }}/${{ matrix.service }}
86- tags : |
87- type=raw,value=pr-${{ github.event.pull_request.number }},enable=${{ github.event_name == 'pull_request' }}
88- type=raw,value=latest,enable=${{ github.event_name == 'push' && github.ref == 'refs/heads/dev' }}
89-
90- - name : Build and push Docker Image
91- uses : docker/build-push-action@v5
92- with :
93- platforms : linux/amd64,linux/arm64
94- context : ./${{ matrix.service }}
95- file : ./${{ matrix.service }}/Dockerfile
96- push : true
97- tags : ${{ steps.meta.outputs.tags }}
98- labels : ${{ steps.meta.outputs.labels }}
99- cache-from : type=gha,scope=${{ matrix.service }}
100- cache-to : type=gha,scope=${{ matrix.service }},mode=max
101-
102- deploy :
103- runs-on : ubuntu-latest
104- needs : build_images
10518 environment :
10619 name : staging
10720
10821 steps :
109- - name : Download full repository artifact
110- uses : actions/download-artifact@v4
111- with :
112- name : full-repository
113- path : .
22+ - name : Checkout code
23+ uses : actions/checkout@v4
11424
11525 - name : Setup Helm
11626 uses : azure/setup-helm@v3
@@ -127,18 +37,33 @@ jobs:
12737 mkdir -p $HOME/.kube
12838 echo "${{ secrets.KUBECONFIG }}" > $HOME/.kube/config
12939
130- - name : Run Helm Upgrade
40+ - name : Run Helm Upgrade for workflow_run
41+ if : github.event_name == 'workflow_run'
42+ run : |
43+ cd helm/ai-event-concepter
44+ helm upgrade --install ai-event-concepter . \
45+ --namespace team-git-push-force-dev \
46+ --create-namespace \
47+ --set ingress.host=dev-aieventconcepter.student.k8s.aet.cit.tum.de \
48+ --set client.image.tag=dev \
49+ --set gateway.image.tag=dev \
50+ --set usersvc.image.tag=dev \
51+ --set conceptsvc.image.tag=dev \
52+ --set genaisvc.image.tag=dev
53+
54+ - name : Run Helm Upgrade for pull_request
55+ if : github.event_name == 'pull_request'
13156 run : |
13257 cd helm/ai-event-concepter
13358 helm upgrade --install ai-event-concepter . \
13459 --namespace team-git-push-force-dev \
13560 --create-namespace \
13661 --set ingress.host=dev-aieventconcepter.student.k8s.aet.cit.tum.de \
137- --set client.image.tag=pr-${{ github.event.pull_request.number || github.sha }} \
138- --set gateway.image.tag=pr-${{ github.event.pull_request.number || github.sha }} \
139- --set usersvc.image.tag=pr-${{ github.event.pull_request.number || github.sha }} \
140- --set conceptsvc.image.tag=pr-${{ github.event.pull_request.number || github.sha }} \
141- --set genaisvc.image.tag=pr-${{ github.event.pull_request.number || github.sha }}
62+ --set client.image.tag=pr-${{ github.event.pull_request.number }} \
63+ --set gateway.image.tag=pr-${{ github.event.pull_request.number }} \
64+ --set usersvc.image.tag=pr-${{ github.event.pull_request.number }} \
65+ --set conceptsvc.image.tag=pr-${{ github.event.pull_request.number }} \
66+ --set genaisvc.image.tag=pr-${{ github.event.pull_request.number }}
14267
14368 - name : Rollout Restart Deployments
14469 run : |
0 commit comments