Merge pull request #30 from co-co-gong/issue#22/docs/cicd #22
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "CI/CD" | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "k8s/deploy/backend.yaml" | |
jobs: | |
ci: | |
name: Docker Build | |
runs-on: ubuntu-latest | |
steps: | |
- 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/co-co-gong-server:[^ ]*|ghcr.io/co-co-gong/co-co-gong-server:${{ github.sha }}|' k8s/deploy/backend.yaml | |
- name: git push | |
run: | | |
git config user.name "Zerohertz" | |
git config user.email "ohg3417@gmail.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 }} |