-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (51 loc) · 1.58 KB
/
cicd.yaml
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
name: "CI/CD"
on:
push:
branches:
- "*"
- "*/*/*"
# - main
jobs:
ci:
name: Docker Build
if: ${{ github.actor != 'github-actions[bot]' }}
runs-on: ubuntu-latest
steps:
- name: Debug actor
run: |
echo "GitHub Actor: ${{ github.actor }}"
- name: Checkout repository
uses: actions/checkout@v4
- name: Login to GitHub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.GH_USERNAME }}
password: ${{ secrets.GH_TOKEN }}
- name: Build and push image
uses: docker/build-push-action@v6
with:
push: true
tags: |
ghcr.io/${{ secrets.GH_USERNAME }}/co-co-gong-server:latest,
ghcr.io/${{ secrets.GH_USERNAME }}/co-co-gong-server:${{ github.sha }}
cd:
name: Argo CD
needs: ci
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN }}
- name: Change manifest
run: |
sed -i 's|ghcr.io/co-co-gong-server:[^ ]*|ghcr.io/co-co-gong-server:${{ github.sha }}|' k8s/deploy/backend.yaml
- name: git push
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config credential.helper store
git add k8s/deploy/backend.yaml
git commit -m ":tada: deploy: co-co-gong-server [${{ github.sha }}]"
git push origin ${{ github.ref_name }}