Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dev-ci.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: CI for dev using github actions
on:
pull_request:
types: [opened, synchronize]
branches: [ "develop" ]
branches: [ "develop", "release" ]

permissions:
contents: read
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/create-jira-bug-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ jobs:
- name: Log created issue
run: echo "Jira Issue ${{ steps.issue-parser.outputs.parentKey }}/${{ steps.create.outputs.issue }} was created"

- name: Checkout develop code
- name: Checkout release code
uses: actions/checkout@v4
with:
ref: develop
ref: release
token: ${{ secrets.PAT_TOKEN }}

- name: Create branch with Ticket number
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dev-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ jobs:
docker run --name taskflow -d -p 9090:9090 \
--env-file /home/ubuntu/.env \
${{ secrets.DOCKER_REPO }} \
--restart on-failure
--restart on-failure
72 changes: 72 additions & 0 deletions .github/workflows/release-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# github repository actions 페이지에 나타날 이름
name: CD for Release

# event trigger
on:
release:
types: [created]

permissions:
contents: read

jobs:
Release-CD:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: 'Set up JDK'
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Extract release version
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT

- run: touch ./Dockerfile
- run: echo "${{ secrets.DEV_DOCKERFILE }}" > ./Dockerfile

# gradle caching - 빌드 시간 향상
- name: Gradle Caching
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-

# gradle build
- name: Build with Gradle
run: |
chmod +x ./gradlew
./gradlew build -x test

# docker build & push
- name: Docker build & push
run: |
docker login clap.kr-central-2.kcr.dev -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t ${{ secrets.DOCKER_REPO }}:${{ steps.version.outputs.VERSION }} -t ${{ secrets.DOCKER_REPO }}:latest .
docker push ${{ secrets.DOCKER_REPO }}:${{ steps.version.outputs.VERSION }}
docker push ${{ secrets.DOCKER_REPO }}:latest

# deploy
- name: Deploy
uses: appleboy/ssh-action@master
id: deploy
with:
host: ${{ secrets.DEV_HOST }}
username: ${{ secrets.DEV_HOST_USERNAME }}
key: ${{ secrets.DEV_HOST_KEY }}
port: ${{ secrets.DEV_HOST_PORT }}
script: |
docker rm -f taskflow
docker image rm ${{ secrets.DOCKER_REPO }}:${{ steps.version.outputs.VERSION }} -f
docker run --name taskflow -d -p 9090:9090 \
--env-file /home/ubuntu/.env \
${{ secrets.DOCKER_REPO }}:${{ steps.version.outputs.VERSION }} \
--restart on-failure