Skip to content

Commit 1497611

Browse files
authored
v1.1.0
v1.1.0
2 parents c74e617 + 6b4c9e8 commit 1497611

File tree

102 files changed

+2066
-457
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+2066
-457
lines changed
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
name: 'Deploy Module'
2+
description: 'Build, push and deploy a module to server (dev/prod)'
3+
4+
inputs:
5+
environment:
6+
description: 'Environment (dev or prod)'
7+
required: true
8+
module:
9+
description: 'Module name (apis, admin, batch)'
10+
required: true
11+
port:
12+
description: 'Server port (for logging only - actual port defined in docker-compose.yml)'
13+
required: false
14+
default: 'N/A'
15+
dockerhub-username:
16+
description: 'Docker Hub username'
17+
required: true
18+
dockerhub-token:
19+
description: 'Docker Hub token'
20+
required: true
21+
secret-properties:
22+
description: 'Secret properties (dev or prod)'
23+
required: true
24+
apple-auth-key:
25+
description: 'Apple Auth Key'
26+
required: true
27+
host:
28+
description: 'Server host'
29+
required: true
30+
username:
31+
description: 'Server username'
32+
required: true
33+
ssh-key:
34+
description: 'Server SSH key'
35+
required: true
36+
ssh-port:
37+
description: 'Server SSH port'
38+
required: true
39+
discord-webhook-url:
40+
description: 'Discord webhook URL'
41+
required: true
42+
image-prefix:
43+
description: 'Docker image prefix'
44+
required: true
45+
image-tag-type:
46+
description: 'Image tag type (development-latest or semver)'
47+
required: true
48+
deploy-script:
49+
description: 'Deploy script name (deploy-dev.sh or deploy-prod.sh)'
50+
required: true
51+
default: 'deploy-dev.sh'
52+
release-version:
53+
description: 'Release version tag (e.g., v1.2.3). Only used in production for metadata tracking.'
54+
required: false
55+
default: 'unknown'
56+
57+
runs:
58+
using: 'composite'
59+
steps:
60+
- name: Inject application-secret.properties from Secrets
61+
shell: bash
62+
run: |
63+
mkdir -p ./secret
64+
echo "$SECRET_CONTENT" > ./secret/application-${{ inputs.environment }}-secret.properties
65+
echo "$APPLE_KEY_CONTENT" > ./secret/AuthKey.p8
66+
chmod 600 ./secret/*
67+
env:
68+
SECRET_CONTENT: ${{ inputs.secret-properties }}
69+
APPLE_KEY_CONTENT: ${{ inputs.apple-auth-key }}
70+
71+
- name: Set up Docker Buildx
72+
uses: docker/setup-buildx-action@v3
73+
74+
- name: Log in to Docker Hub
75+
uses: docker/login-action@v3
76+
with:
77+
username: ${{ inputs.dockerhub-username }}
78+
password: ${{ inputs.dockerhub-token }}
79+
80+
- name: Extract metadata for Docker
81+
id: meta
82+
uses: docker/metadata-action@v5
83+
with:
84+
images: docker.io/${{ inputs.image-prefix }}-${{ inputs.module }}
85+
tags: ${{ inputs.image-tag-type }}
86+
87+
- name: Build and push Docker image
88+
id: build-and-push
89+
uses: docker/build-push-action@v6
90+
with:
91+
context: .
92+
file: ./Dockerfile
93+
platforms: linux/amd64
94+
push: true
95+
tags: ${{ steps.meta.outputs.tags }}
96+
cache-from: type=gha,scope=${{ inputs.module }}
97+
cache-to: type=gha,mode=max,scope=${{ inputs.module }}
98+
build-args: |
99+
MODULE=${{ inputs.module }}
100+
101+
- name: Deploy to Server
102+
uses: appleboy/[email protected]
103+
with:
104+
host: ${{ inputs.host }}
105+
username: ${{ inputs.username }}
106+
key: ${{ inputs.ssh-key }}
107+
port: ${{ inputs.ssh-port }}
108+
script: |
109+
export DOCKERHUB_USERNAME="${{ inputs.dockerhub-username }}"
110+
export DOCKERHUB_TOKEN="${{ inputs.dockerhub-token }}"
111+
export MODULE="${{ inputs.module }}"
112+
export SPRING_PROFILE="${{ inputs.environment }}"
113+
export IMAGE_TAG="$(echo "${{ steps.meta.outputs.tags }}" | head -n1)"
114+
export RELEASE_VERSION="${{ inputs.release-version }}"
115+
cd ~/deploy
116+
chmod +x ./${{ inputs.deploy-script }}
117+
./${{ inputs.deploy-script }}
118+
119+
- name: Send Discord notification on success (Development)
120+
uses: tsickert/discord-webhook@b217a69502f52803de774ded2b1ab7c282e99645
121+
if: success() && inputs.environment == 'dev'
122+
continue-on-error: true
123+
with:
124+
webhook-url: ${{ inputs.discord-webhook-url }}
125+
embed-title: "✅ [${{ github.repository }}] Development Deploy Succeeded - ${{ inputs.module }}"
126+
embed-description: |
127+
**Module**: `${{ inputs.module }}`
128+
**Commit**: `${{ github.sha }}`
129+
**Author**: `${{ github.actor }}`
130+
**Message**: `${{ github.event.head_commit.message }}`
131+
[View Committed Changes](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
132+
embed-color: 65280
133+
134+
- name: Send Discord notification on success (Production)
135+
uses: tsickert/discord-webhook@b217a69502f52803de774ded2b1ab7c282e99645
136+
if: success() && inputs.environment == 'prod'
137+
continue-on-error: true
138+
with:
139+
webhook-url: ${{ inputs.discord-webhook-url }}
140+
content: "🚀 **Production Deploy Succeeded!**"
141+
embed-title: "✅ [${{ github.repository }}] Production Deploy Succeeded - ${{ inputs.module }}"
142+
embed-description: |
143+
**Module**: `${{ inputs.module }}`
144+
**Deployed by**: `${{ github.actor }}`
145+
The new version has been successfully deployed to production.
146+
[View Workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
147+
embed-color: 65280
148+
149+
- name: Send Discord notification on failure (Development)
150+
uses: tsickert/discord-webhook@b217a69502f52803de774ded2b1ab7c282e99645
151+
if: failure() && inputs.environment == 'dev'
152+
continue-on-error: true
153+
with:
154+
webhook-url: ${{ inputs.discord-webhook-url }}
155+
embed-title: "❌ [${{ github.repository }}] Development Deploy Failed - ${{ inputs.module }}"
156+
embed-description: |
157+
**Module**: `${{ inputs.module }}`
158+
**Commit**: `${{ github.sha }}`
159+
**Author**: `${{ github.actor }}`
160+
An error occurred during the workflow execution.
161+
[View Failed Workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
162+
embed-color: 16711680
163+
164+
- name: Send Discord notification on failure (Production)
165+
uses: tsickert/discord-webhook@b217a69502f52803de774ded2b1ab7c282e99645
166+
if: failure() && inputs.environment == 'prod'
167+
continue-on-error: true
168+
with:
169+
webhook-url: ${{ inputs.discord-webhook-url }}
170+
content: "🚨 **Production Deploy Failed!**"
171+
embed-title: "❌ [${{ github.repository }}] Production Deploy Failed - ${{ inputs.module }}"
172+
embed-description: |
173+
**Module**: `${{ inputs.module }}`
174+
**Deployed by**: `${{ github.actor }}`
175+
An error occurred during the production deployment workflow.
176+
[View Failed Workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
177+
embed-color: 16711680

.github/workflows/ci-pr.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,8 @@ jobs:
5858
env:
5959
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
6060
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
61-
run: ./gradlew fullCheck --parallel --build-cache --info --stacktrace
61+
run: |
62+
# fullCheck: 모든 모듈 (apis, admin, batch, gateway 등)의 빌드, 테스트, 정적분석 수행
63+
# --parallel: 모듈별 병렬 빌드로 시간 단축
64+
# --build-cache: Gradle 빌드 캐시 사용
65+
./gradlew fullCheck --parallel --build-cache --info --stacktrace

.github/workflows/close-jira-issue.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ jobs:
2929
uses: atlassian/gajira-transition@v3
3030
with:
3131
issue: ${{ env.JIRA_KEY }}
32-
transition: "31"
32+
transition: 개발 완료

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
uses: atlassian/gajira-create@v3
8686
with:
8787
project: BOOK
88-
issuetype: Task
88+
issuetype: 하위 작업
8989
summary: '${{ github.event.issue.title }}'
9090
description: '${{ steps.md2jira.outputs.output-text }}'
9191
fields: |

.github/workflows/dev-ci-cd.yml

Lines changed: 76 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -11,96 +11,93 @@ concurrency:
1111

1212
env:
1313
REGISTRY: docker.io
14-
IMAGE_NAME: ninecraft0523/ninecraft-server
15-
MODULE: apis
14+
IMAGE_PREFIX: ninecraft0523/ninecraft
1615

1716
jobs:
18-
build-push-and-deploy:
17+
detect-changes:
1918
runs-on: ubuntu-24.04
20-
timeout-minutes: 20
21-
environment: development
22-
19+
outputs:
20+
apis: ${{ steps.filter.outputs.apis }}
21+
# admin: ${{ steps.filter.outputs.admin }} # TODO: Uncomment when admin module is ready
22+
batch: ${{ steps.filter.outputs.batch }}
23+
any: ${{ steps.filter.outputs.any }}
2324
steps:
2425
- name: Checkout code
2526
uses: actions/checkout@v4
2627

27-
- name: Inject application-secret.properties from Secrets
28-
run: |
29-
mkdir ./secret
30-
echo "${{ secrets.DEV_SECRET_PROPERTIES }}" > ./secret/application-dev-secret.properties
31-
echo "${{ secrets.APPLE_AUTH_KEY }}" > ./secret/AuthKey.p8
32-
chmod 600 ./secret/*
33-
34-
- name: Set up Docker Buildx
35-
uses: docker/setup-buildx-action@v3
36-
37-
- name: Log in to Docker Hub
38-
uses: docker/login-action@v3
28+
- name: Check changed files
29+
uses: dorny/paths-filter@v3
30+
id: filter
3931
with:
40-
username: ${{ secrets.DOCKERHUB_USERNAME }}
41-
password: ${{ secrets.DOCKERHUB_TOKEN }}
32+
filters: |
33+
apis:
34+
- 'apis/**'
35+
- 'domain/**'
36+
- 'infra/**'
37+
- 'global-utils/**'
38+
- 'observability/**'
39+
- '.github/**'
40+
# admin: # TODO: Uncomment when admin module is ready
41+
# - 'admin/**'
42+
# - 'domain/**'
43+
# - 'infra/**'
44+
# - 'global-utils/**'
45+
# - 'observability/**'
46+
# - '.github/**'
47+
batch:
48+
- 'batch/**'
49+
- 'domain/**'
50+
- 'infra/**'
51+
- 'global-utils/**'
52+
- 'observability/**'
53+
- '.github/**'
54+
any:
55+
- 'apis/**'
56+
# - 'admin/**' # TODO: Uncomment when admin module is ready
57+
- 'batch/**'
58+
- 'domain/**'
59+
- 'infra/**'
60+
- 'global-utils/**'
61+
- 'observability/**'
62+
- '.github/**'
4263
43-
- name: Extract metadata for Docker
44-
id: meta
45-
uses: docker/metadata-action@v5
46-
with:
47-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
48-
tags: |
49-
type=raw,value=development-latest
64+
build-push-and-deploy:
65+
needs: detect-changes
66+
if: needs.detect-changes.outputs.any == 'true'
67+
runs-on: ubuntu-24.04
68+
timeout-minutes: 20
69+
environment: development
70+
strategy:
71+
fail-fast: false
72+
matrix:
73+
include:
74+
- module: apis
75+
changed: ${{ needs.detect-changes.outputs.apis }}
76+
# - module: admin # TODO: Uncomment when admin module is ready
77+
# changed: ${{ needs.detect-changes.outputs.admin }}
78+
- module: batch
79+
changed: ${{ needs.detect-changes.outputs.batch }}
5080

51-
- name: Build and push Docker image
52-
id: build-and-push
53-
uses: docker/build-push-action@v6
54-
with:
55-
context: .
56-
file: ./Dockerfile
57-
platforms: linux/amd64
58-
push: true
59-
tags: ${{ steps.meta.outputs.tags }}
60-
cache-from: type=gha
61-
cache-to: type=gha,mode=max
62-
build-args: |
63-
MODULE=${{ env.MODULE }}
81+
steps:
82+
- name: Checkout code
83+
if: matrix.changed == 'true'
84+
uses: actions/checkout@v4
6485

65-
- name: Deploy to Development Server
66-
uses: appleboy/[email protected]
86+
- name: Deploy module
87+
if: matrix.changed == 'true'
88+
uses: ./.github/actions/deploy-module
6789
with:
90+
environment: dev
91+
module: ${{ matrix.module }}
92+
dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }}
93+
dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }}
94+
secret-properties: ${{ secrets.DEV_SECRET_PROPERTIES }}
95+
apple-auth-key: ${{ secrets.APPLE_AUTH_KEY }}
6896
host: ${{ secrets.DEV_HOST }}
6997
username: ${{ secrets.DEV_USERNAME }}
70-
key: ${{ secrets.DEV_SSH_KEY }}
71-
port: ${{ secrets.DEV_PORT }}
72-
script: |
73-
export DOCKERHUB_USERNAME="${{ secrets.DOCKERHUB_USERNAME }}"
74-
export DOCKERHUB_TOKEN="${{ secrets.DOCKERHUB_TOKEN }}"
75-
export IMAGE_TAG="$(echo "${{ steps.meta.outputs.tags }}" | head -n1)"
76-
cd ~/deploy
77-
chmod +x ./deploy.sh
78-
./deploy.sh
79-
80-
- name: Send Discord notification on success
81-
uses: tsickert/discord-webhook@b217a69502f52803de774ded2b1ab7c282e99645
82-
if: success()
83-
continue-on-error: true
84-
with:
85-
webhook-url: ${{ secrets.DEV_DEPLOY_DISCORD_WEBHOOK_URL }}
86-
embed-title: "✅ [${{ github.repository }}] Development Deploy Succeeded"
87-
embed-description: |
88-
**Commit**: `${{ github.sha }}`
89-
**Author**: `${{ github.actor }}`
90-
**Message**: `${{ github.event.head_commit.message }}`
91-
[View Committed Changes](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
92-
embed-color: 65280
93-
94-
- name: Send Discord notification on failure
95-
uses: tsickert/discord-webhook@b217a69502f52803de774ded2b1ab7c282e99645
96-
if: failure()
97-
continue-on-error: true
98-
with:
99-
webhook-url: ${{ secrets.DEV_DEPLOY_DISCORD_WEBHOOK_URL }}
100-
embed-title: "❌ [${{ github.repository }}] Development Deploy Failed"
101-
embed-description: |
102-
**Commit**: `${{ github.sha }}`
103-
**Author**: `${{ github.actor }}`
104-
An error occurred during the workflow execution.
105-
[View Failed Workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
106-
embed-color: 16711680
98+
ssh-key: ${{ secrets.DEV_SSH_KEY }}
99+
ssh-port: ${{ secrets.DEV_PORT }}
100+
discord-webhook-url: ${{ secrets.DEV_DEPLOY_DISCORD_WEBHOOK_URL }}
101+
image-prefix: ${{ env.IMAGE_PREFIX }}
102+
image-tag-type: type=raw,value=development-latest
103+
deploy-script: deploy-dev.sh

0 commit comments

Comments
 (0)