File tree Expand file tree Collapse file tree 2 files changed +84
-0
lines changed
Expand file tree Collapse file tree 2 files changed +84
-0
lines changed Original file line number Diff line number Diff line change 1+ name : CD Pipeline
2+
3+ on :
4+ workflow_run :
5+ workflows : [ "CI pipeline" ]
6+ types :
7+ - completed
8+
9+ jobs :
10+ deploy-to-k8s :
11+ if : ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main' }}
12+ runs-on : ubuntu-latest
13+
14+ steps :
15+ - name : Install kubectl
16+ run : |
17+ curl -LO "https://dl.k8s.io/release/$(\
18+ curl -L -s https://dl.k8s.io/release/stable.txt\
19+ )/bin/linux/amd64/kubectl"
20+ chmod +x kubectl
21+ sudo mv kubectl /usr/local/bin/
22+
23+ - name : Setup kubeconfig
24+ run : |
25+ mkdir -p $HOME/.kube
26+ echo "${{ secrets.KUBE_CONFIG_DATA }}" | base64 --decode > $HOME/.kube/config
27+ chmod 600 $HOME/.kube/config
28+
29+ - name : Install kic-iam-auth plugin
30+ run : |
31+ curl -L "https://objectstorage.kr-central-2.kakaocloud.com/v1/c11fcba415bd4314b595db954e4d4422/public/docs/binaries-kic-iam-auth/Linux%20x86_64%2064Bit/kic-iam-auth" \
32+ -o kic-iam-auth
33+ chmod +x kic-iam-auth
34+ sudo cp kic-iam-auth /usr/local/bin/
35+
36+ - name : Test kubectl 연결
37+ run : kubectl get nodes -n trendist
38+
39+ - name : Rollout restart deployment
40+ run : kubectl rollout restart deployment/issue-service -n trendist
Original file line number Diff line number Diff line change 1+ name : CI pipeline
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ workflow_dispatch :
8+
9+ jobs :
10+ build :
11+ runs-on : ubuntu-latest
12+ environment : production
13+
14+ steps :
15+ - name : Checkout
16+ uses : actions/checkout@v4
17+
18+ - name : jdk 설정
19+ uses : actions/setup-java@v4
20+ with :
21+ distribution : ' temurin'
22+ java-version : ' 17'
23+ cache : ' gradle'
24+
25+ - name : Gradle Wrapper 권한 부여
26+ run : chmod +x gradlew
27+
28+ - name : gradle 빌드
29+ run : ./gradlew clean build
30+
31+ - name : Kakao Cloud Container Registry 로그인
32+ uses : docker/login-action@v3
33+ with :
34+ registry : highfive.kr-central-2.kcr.dev
35+ username : ${{ secrets.KCR_USERNAME }}
36+ password : ${{ secrets.KCR_PASSWORD }}
37+
38+ - name : 이미지 빌드 및 푸시
39+ uses : docker/build-push-action@v5
40+ with :
41+ context : .
42+ file : ./Dockerfile
43+ tags : highfive.kr-central-2.kcr.dev/trendist-dev/issue-service:latest
44+ push : true
You can’t perform that action at this time.
0 commit comments