Skip to content

Commit c5689d0

Browse files
authored
Merge pull request #14 from HIGHFIVE-SW/chore/#13
chore: ci/cd 구축
2 parents ad43238 + c44f362 commit c5689d0

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

.github/workflows/cd-prod.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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

.github/workflows/ci.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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

0 commit comments

Comments
 (0)