-
Notifications
You must be signed in to change notification settings - Fork 44
97 lines (79 loc) · 3.05 KB
/
deployment.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: deployment workflow
on:
workflow_run:
workflows:
- main workflow
types:
- completed
branches:
- master
jobs:
setup:
runs-on: ubuntu-20.04
if: ${{ github.event.workflow_run.conclusion == 'success' }}
outputs:
image-name: ${{ steps.output.outputs.image-name }}
steps:
- name: set image name
run:
echo "IMAGE_NAME=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> ${{ github.env }}
- name: set output
id: output
run: echo "::set-output name=image-name::${{ env.IMAGE_NAME }}:${{ github.sha }}"
deployment-comment:
runs-on: ubuntu-20.04
needs:
- setup
environment: production-comment
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup kubectl
uses: justin0u0/setup-kubectl@v1
with:
kubectl-version: stable
cluster-certificate-authority-data: ${{ secrets.KUBERNETES_CLUSTER_CLIENT_CERTIFICATE_AUTHORITY_DATA }}
cluster-server: ${{ secrets.KUBERNETES_CLUSTER_SERVER }}
credentials-token: ${{ secrets.KUBERNETES_CREDENTIALS_TOKEN }}
- name: deploy comment-migration
run: kubectl set image cronjob/comment-migration comment-migration=${{ needs.setup.outputs.image-name }}
- name: run migration job
uses: ./.github/actions/run-migration
with:
migration-cronjob-name: comment-migration
migration-job-name: comment-migration-${{ github.run_id }}
- name: deploy comment-api
run: kubectl set image deploy/comment-api comment-api=${{ needs.setup.outputs.image-name }}
- name: deploy comment-gateway
run: kubectl set image deploy/comment-gateway comment-gateway=${{ needs.setup.outputs.image-name }}
- name: wait comment-api
run: kubectl rollout status -w deploy/comment-api
- name: wait comment-gateway
run: kubectl rollout status -w deploy/comment-gateway
deployment-video:
runs-on: ubuntu-20.04
needs:
- setup
environment: production-video
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup kubectl
uses: justin0u0/setup-kubectl@v1
with:
kubectl-version: stable
cluster-certificate-authority-data: ${{ secrets.KUBERNETES_CLUSTER_CLIENT_CERTIFICATE_AUTHORITY_DATA }}
cluster-server: ${{ secrets.KUBERNETES_CLUSTER_SERVER }}
credentials-token: ${{ secrets.KUBERNETES_CREDENTIALS_TOKEN }}
- name: deploy video-api
run: kubectl set image deploy/video-api video-api=${{ needs.setup.outputs.image-name }}
- name: deploy video-gateway
run: kubectl set image deploy/video-gateway video-gateway=${{ needs.setup.outputs.image-name }}
- name: deploy video-stream
run: kubectl set image deploy/video-stream video-stream=${{ needs.setup.outputs.image-name }}
- name: wait video-api
run: kubectl rollout status -w deploy/video-api
- name: wait video-gateway
run: kubectl rollout status -w deploy/video-gateway
- name: wait video-stream
run: kubectl rollout status -w deploy/video-stream