Skip to content

Commit ab97a47

Browse files
authored
Merge pull request #445 from TaskFlow-CLAP/CLAP-338
CLAP-338 릴리즈 브랜치 ci/cd 워크플로우 적용
2 parents fe11ced + 90bd260 commit ab97a47

File tree

4 files changed

+76
-4
lines changed

4 files changed

+76
-4
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ name: CI for dev using github actions
66
on:
77
pull_request:
88
types: [opened, synchronize]
9-
branches: [ "develop" ]
9+
branches: [ "develop", "release" ]
1010

1111
permissions:
1212
contents: read

.github/workflows/create-jira-bug-issue.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ jobs:
7474
- name: Log created issue
7575
run: echo "Jira Issue ${{ steps.issue-parser.outputs.parentKey }}/${{ steps.create.outputs.issue }} was created"
7676

77-
- name: Checkout develop code
77+
- name: Checkout release code
7878
uses: actions/checkout@v4
7979
with:
80-
ref: develop
80+
ref: release
8181
token: ${{ secrets.PAT_TOKEN }}
8282

8383
- name: Create branch with Ticket number

.github/workflows/dev-cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ jobs:
6565
docker run --name taskflow -d -p 9090:9090 \
6666
--env-file /home/ubuntu/.env \
6767
${{ secrets.DOCKER_REPO }} \
68-
--restart on-failure
68+
--restart on-failure

.github/workflows/release-cd.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# github repository actions 페이지에 나타날 이름
2+
name: CD for Release
3+
4+
# event trigger
5+
on:
6+
release:
7+
types: [created]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
Release-CD:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: 'Set up JDK'
19+
uses: actions/setup-java@v3
20+
with:
21+
java-version: '17'
22+
distribution: 'temurin'
23+
24+
- name: Extract release version
25+
id: version
26+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
27+
28+
- run: touch ./Dockerfile
29+
- run: echo "${{ secrets.DEV_DOCKERFILE }}" > ./Dockerfile
30+
31+
# gradle caching - 빌드 시간 향상
32+
- name: Gradle Caching
33+
uses: actions/cache@v4
34+
with:
35+
path: |
36+
~/.gradle/caches
37+
~/.gradle/wrapper
38+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
39+
restore-keys: |
40+
${{ runner.os }}-gradle-
41+
42+
# gradle build
43+
- name: Build with Gradle
44+
run: |
45+
chmod +x ./gradlew
46+
./gradlew build -x test
47+
48+
# docker build & push
49+
- name: Docker build & push
50+
run: |
51+
docker login clap.kr-central-2.kcr.dev -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
52+
docker build -t ${{ secrets.DOCKER_REPO }}:${{ steps.version.outputs.VERSION }} -t ${{ secrets.DOCKER_REPO }}:latest .
53+
docker push ${{ secrets.DOCKER_REPO }}:${{ steps.version.outputs.VERSION }}
54+
docker push ${{ secrets.DOCKER_REPO }}:latest
55+
56+
# deploy
57+
- name: Deploy
58+
uses: appleboy/ssh-action@master
59+
id: deploy
60+
with:
61+
host: ${{ secrets.DEV_HOST }}
62+
username: ${{ secrets.DEV_HOST_USERNAME }}
63+
key: ${{ secrets.DEV_HOST_KEY }}
64+
port: ${{ secrets.DEV_HOST_PORT }}
65+
script: |
66+
docker rm -f taskflow
67+
docker image rm ${{ secrets.DOCKER_REPO }}:${{ steps.version.outputs.VERSION }} -f
68+
docker run --name taskflow -d -p 9090:9090 \
69+
--env-file /home/ubuntu/.env \
70+
${{ secrets.DOCKER_REPO }}:${{ steps.version.outputs.VERSION }} \
71+
--restart on-failure
72+

0 commit comments

Comments
 (0)