-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (60 loc) · 1.79 KB
/
cicd.yaml
File metadata and controls
63 lines (60 loc) · 1.79 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
name: cicd
on:
workflow_dispatch: {}
# Manual trigger only to avoid pipeline noise
# Uncomment below to enable automatic builds on push
# push:
# paths:
# - src/**
# branches:
# - main
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: tyrelfecha/python-app:${{ env.COMMIT_ID }}
outputs:
commit_id: ${{ env.COMMIT_ID }}
cd:
needs: ci
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- name: Modify values file
shell: bash
run: |
echo ${{needs.ci.outputs.commit_id}}
pip install yq
yq -Yi '.image.tag = "${{needs.ci.outputs.commit_id}}"' chart/python-app/values.yaml
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
message: 'Updates values.yaml with commit ${{needs.ci.outputs.commit_id}}'
- name: Install argocd
shell: bash
run: |
curl -ksSL -o argocd-linux-amd64 https://argocd-server.argocd/download/argocd-linux-amd64
chmod +x argocd-linux-amd64
sudo mv argocd-linux-amd64 /usr/local/bin/argocd
- name: Argocd app sync
shell: bash
run: |
argocd login argocd-server.argocd \
--insecure \
--grpc-web \
--username admin \
--password ${{ secrets.ARGOCD_PASSWORD }}
argocd app sync python-app