-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (38 loc) · 1.19 KB
/
Copy pathdocument-cd.yml
File metadata and controls
45 lines (38 loc) · 1.19 KB
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
name: Document API CD
on:
workflow_run:
workflows: ["Document API CI"]
types:
- completed
jobs:
deploy:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Setup kubectl
uses: azure/setup-kubectl@v3
with:
version: 'latest'
- name: Docker login (cmd)
shell: cmd
run: |
@echo off
if "%DOCKER_USERNAME%"=="" (
echo Docker username is missing!
exit /b 1
)
if "%DOCKER_PASSWORD%"=="" (
echo Docker password is missing!
exit /b 1
)
echo %DOCKER_PASSWORD% | docker login -u %DOCKER_USERNAME% --password-stdin
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- name: Pull latest Document API image
run: docker pull gyliana/document-api:latest
- name: Update Kubernetes deployment
run: |
kubectl set image deployment/document-api document-api=gyliana/document-api:latest
kubectl rollout restart deployment/document-api