Merge pull request #80 from DoTheZ-Team/GLUE-386-빌드-트리거 #28
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: Glue Client CI/CD Pipeline | |
on: | |
push: | |
branches: ["main"] | |
permissions: | |
contents: read | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: ENV File 설정중 | |
run: | | |
touch .env | |
echo "${{ secrets.ENV }}" >> .env | |
shell: bash | |
- name: 도커 레지스트리 로그인중... | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ secrets.GLUE_PROJECT }} | |
username: ${{ secrets.ACCESS_ID }} | |
password: ${{ secrets.ACCESS_SECRET }} | |
- name: 카카오 클라우드에 빌드 및 푸시중.. | |
uses: docker/build-push-action@v4 | |
with: | |
file: Dockerfile | |
context: . | |
push: true | |
tags: ${{ secrets.GLUE_PROJECT }}/glue-repository/glue-client:${{ github.sha }} | |
update-manifest-state: | |
runs-on: ubuntu-latest | |
needs: build-and-push-image | |
steps: | |
- name: glue-msa-config 레포지토리 체크중.. | |
uses: actions/checkout@v3 | |
with: | |
repository: ${{ secrets.GIT_PROJECT }}/glue-msa-config | |
token: ${{ secrets.GIT_TOKEN }} | |
ref: "main" | |
- name: yq 설치중.. | |
run: sudo snap install yq | |
- name: 배포 파일에서 이미지 업데이트중.. | |
run: | | |
yq e '.spec.template.spec.containers[0].image = "${{ secrets.GLUE_PROJECT }}/glue-repository/glue-client:${{ github.sha }}"' -i ./k8s-template/client-deployment.yaml | |
- name: 커밋 및 푸시중.. | |
run: | | |
git config --global user.email "${{ secrets.EMAIL }}" | |
git config --global user.name "${{ secrets.USERNAME }}" | |
git add . | |
git commit -m "[skip ci] Update glue-client-deployment.yaml" | |
git remote set-url origin https://${{ secrets.GIT_TOKEN }}@github.com/${{ secrets.GIT_PROJECT }}/glue-msa-config | |
git push --set-upstream origin main |