-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (59 loc) · 1.62 KB
/
python-app-2-cicd.yaml
File metadata and controls
70 lines (59 loc) · 1.62 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
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
name: python-app-2-cicd
on:
push:
paths:
- src/**
branches:
- master
jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Shorten commit id
shell: bash
run: |
echo "COMMIT_ID=${GITHUB_SHA::6}" >> "$GITHUB_ENV"
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: sina2012/python-app-2:${{ env.COMMIT_ID }}
outputs:
commit_id: ${{ env.COMMIT_ID }}
cd:
needs: ci
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- name: Modify value file
shell: bash
run: |
echo ${{needs.ci.outputs.commit_id}}
pip install yq
yq -Yi '.image.tag = "${{needs.ci.outputs.commit_id}}"' charts/python-app-2/valuesdev.yaml
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
message: 'Updates values.yaml with commit '
- name: Install argocd
shell: bash
run: |
curl -ksSL -o argocd https://argocd-server.argocd/download/argocd-linux-amd64
chmod +x argocd
sudo mv ./argocd /usr/local/bin/argocd
- name: Argocd app sync
shell: bash
run: |
argocd login argocd-server.argocd \
--insecure \
--grpc-web \
--username \
--password
argocd app sync python-app-2