-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3a20df1
Showing
104 changed files
with
4,883 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
root = true | ||
|
||
[*] | ||
# [encoding-utf8] | ||
charset = utf-8 | ||
end_of_line = lf | ||
|
||
# [newline-eof] | ||
insert_final_newline = true | ||
|
||
[*.bat] | ||
end_of_line = crlf | ||
|
||
[*.java] | ||
# [indentation-tab] | ||
indent_style = tab | ||
|
||
# [4-spaces-tab] | ||
indent_size = 4 | ||
tab_width = 4 | ||
|
||
# [no-trailing-spaces] | ||
trim_trailing_whitespace = true | ||
|
||
[line-length-120] | ||
max_line_length = 120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
*.png binary | ||
*.jpg binary | ||
*.jpeg binary | ||
*.gif binary | ||
*.bat text merge=union eol=crlf | ||
* text=auto eol=lf | ||
*.java text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
name: 'People Here Dev Build' | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
environment: | ||
type: string | ||
required: true | ||
COMMIT_MESSAGE: | ||
type: string | ||
required: true | ||
API_SERVER: | ||
required: true | ||
type: string | ||
STAGE: | ||
required: true | ||
type: string | ||
FORCE_REBUILD: | ||
required: false | ||
type: boolean | ||
outputs: | ||
APP_VERSION: | ||
value: ${{ jobs.build.outputs.APP_VERSION }} | ||
CACHE_KEY: | ||
value: ${{ jobs.build.outputs.CACHE_KEY }} | ||
|
||
env: | ||
STAGE: ${{ inputs.STAGE }} | ||
API_SERVER: ${{ inputs.API_SERVER}} | ||
CACHE_KEY: ${{ github.ref }}-${{ inputs.environment }}-${{ github.sha }} | ||
|
||
jobs: | ||
build: | ||
name: Build & Test | ||
environment: ${{ inputs.environment }} | ||
runs-on: ubuntu-latest | ||
outputs: | ||
APP_VERSION: ${{ steps.app-version.outputs.APP_VERSION }} | ||
CACHE_KEY: ${{ env.CACHE_KEY }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Start | ||
run: | | ||
echo "\ | ||
___ __ __ __ | ||
/\_ \ /\ \ /\ \ /\ \ | ||
_____ __ ___ _____ \//\ \ __ \ \ \___ __ _ __ __ \ \ \ \ \ \ | ||
/\ '__`\ /'__`\ / __`\ /\ '__`\ \ \ \ /'__`\ \ \ _ `\ /'__`\ /\`'__\ /'__`\ \ \ \ \ \ \ | ||
\ \ \L\ \/\ __/ /\ \L\ \\ \ \L\ \ \_\ \_ /\ __/ \ \ \ \ \ /\ __/ \ \ \/ /\ __/ \ \_\ \ \_\ | ||
\ \ ,__/\ \____\\ \____/ \ \ ,__/ /\____\\ \____\ \ \_\ \_\\ \____\ \ \_\ \ \____\ \/\_\ \/\_\ | ||
\ \ \/ \/____/ \/___/ \ \ \/ \/____/ \/____/ \/_/\/_/ \/____/ \/_/ \/____/ \/_/ \/_/ | ||
\ \_\ \ \_\ | ||
\/_/ \/_/" | ||
shell: bash | ||
|
||
- name: 버전 세팅 | ||
id: app-version | ||
run: | | ||
BUILD_DATE=$(TZ=Asia/Seoul date +'%Y-%m-%d-%H-%M') | ||
case ${BRANCH_NAME} in | ||
"main"|"staging"|"develop") | ||
APP_VERSION="${STAGE:0:1}-${BUILD_DATE}" | ||
;; | ||
"feature/"*) | ||
ISSUE_NAME=$(echo "${BRANCH_NAME}" | sed -n 's/.*\(PH-[0-9]*\).*/\1/p') | ||
APP_VERSION="${ISSUE_NAME}-${BUILD_DATE}" | ||
;; | ||
*) | ||
APP_VERSION="${STAGE}-${{ github.run_id }}" | ||
;; | ||
esac | ||
echo "APP_VERSION=${APP_VERSION}" | tee -a $GITHUB_ENV >> $GITHUB_OUTPUT | ||
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_OUTPUT | ||
shell: bash | ||
env: | ||
BRANCH_NAME: ${{ github.ref_name }} | ||
STAGE: ${{ env.STAGE }} | ||
|
||
- name: 캐시 재사용 체크 | ||
uses: actions/cache/restore@v4 | ||
if: inputs.FORCE_REBUILD != true | ||
id: artifact-cache-restore | ||
with: | ||
path: | | ||
.build/jar/*.jar | ||
key: ${{ env.CACHE_KEY }} | ||
|
||
- name: 버전정보 캐시정보 출력 | ||
run: | | ||
echo "# 앱 버전 APP_VERSION [ ${{ env.APP_VERSION }} ]" | ||
if [ "${{ steps.artifact-cache-restore.outputs.cache-hit }}" == "true" ]; then | ||
echo "### 캐시 ✅ (key: ${{ env.CACHE_KEY }})" >> $GITHUB_STEP_SUMMARY | ||
else | ||
echo "### 캐시 없음 ❎ (key: ${{ env.CACHE_KEY }})" >> $GITHUB_STEP_SUMMARY | ||
fi | ||
echo "" >> $GITHUB_STEP_SUMMARY | ||
echo "" >> $GITHUB_STEP_SUMMARY | ||
# java 셋업 | ||
- name: Set up JDK 21 | ||
if: steps.artifact-cache-restore.outputs.cache-hit != 'true' | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'corretto' | ||
java-version: '21' | ||
|
||
# gradle caching | ||
- uses: actions/cache@v4 | ||
name: Setup gradle cache | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
${{ runner.os }}-gradle- | ||
- name: API 빌드 - JAR | ||
if: steps.artifact-cache-restore.outputs.cache-hit != 'true' | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
arguments: -i :module-api:build | ||
|
||
- uses: actions/cache/save@v3 | ||
if: ${{ steps.artifact-cache-restore.outputs.cache-hit != 'true' && ! endsWith(steps.app-version.outputs.BRANCH_NAME, '/merge') }} | ||
id: artifact-cache | ||
with: | ||
path: | | ||
.build/jar/*.jar | ||
key: ${{ env.CACHE_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: 3. Develop 🚀 | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
deploy-api: | ||
description: Develop API 서버 배포 🎉🤣 | ||
type: boolean | ||
required: false | ||
force-rebuild: | ||
description: 강제 빌드 | ||
type: boolean | ||
required: false | ||
|
||
push: | ||
branches: | ||
- develop | ||
# - 'feature/**' | ||
pull_request: | ||
branches: | ||
- develop | ||
|
||
# https://github.com/gradle/gradle-build-action#caching | ||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build: | ||
name: 빌드 & 테스트 | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
uses: ./.github/workflows/build.yml | ||
with: | ||
environment: develop | ||
COMMIT_MESSAGE: ${{ github.event.head_commit.message }} | ||
API_SERVER: https://dev.peoplehere.world | ||
STAGE: develop | ||
FORCE_REBUILD: ${{ inputs.force-rebuild == true }} | ||
secrets: inherit | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: 1. Production | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
deploy-api: | ||
description: Production API 서버 배포 🎉🤣 | ||
type: boolean | ||
required: false | ||
force-rebuild: | ||
description: 강제 빌드 | ||
type: boolean | ||
required: false | ||
version-to-upgrade: | ||
description: 배포 버전 업그레이드 | ||
type: choice | ||
required: true | ||
options: | ||
- major | ||
- minor | ||
- patch | ||
default: patch | ||
|
||
push: | ||
branches: | ||
- main | ||
|
||
# https://github.com/gradle/gradle-build-action#caching | ||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build: | ||
name: 빌드 & 테스트 | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
uses: ./.github/workflows/build.yml | ||
with: | ||
environment: production | ||
COMMIT_MESSAGE: ${{ github.event.head_commit.message }} | ||
API_SERVER: https://prod.peoplehere.world | ||
STAGE: production | ||
FORCE_REBUILD: ${{ inputs.force-rebuild == true }} | ||
secrets: inherit | ||
|
||
release: | ||
if: ${{ github.event_name == 'workflow_dispatch' }} | ||
name: 릴리즈 | ||
uses: ./.github/workflows/release.yml | ||
with: | ||
environment: production | ||
STAGE: production | ||
CACHE_KEY: ${{ needs.build.outputs.CACHE_KEY }} | ||
VERSION_TO_UPGRADE: ${{ github.event.inputs.version-to-upgrade }} | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
name: 'peoplehere-release' | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
environment: | ||
type: string | ||
required: true | ||
STAGE: | ||
type: string | ||
required: true | ||
CACHE_KEY: | ||
type: string | ||
required: true | ||
VERSION_TO_UPGRADE: # major.minor.patch | ||
type: string | ||
required: true | ||
outputs: | ||
APP_VERSION: | ||
value: ${{ jobs.release.outputs.APP_VERSION }} | ||
CACHE_KEY: | ||
value: ${{ jobs.release.outputs.CACHE_KEY }} | ||
|
||
env: | ||
owner: People-Here | ||
repo: people-here-dev | ||
|
||
jobs: | ||
release: | ||
name: Release New Version | ||
environment: ${{ inputs.environment }} | ||
runs-on: ubuntu-latest | ||
outputs: | ||
APP_VERSION: ${{ env.new-version }}-${{ env.release-date }} | ||
CACHE_KEY: ${{ inputs.CACHE_KEY }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: 캐시 불러오기 | ||
uses: actions/cache/restore@v3 | ||
id: artifact-cache-restore | ||
with: | ||
path: | | ||
.build/jar/*.jar | ||
key: ${{ inputs.CACHE_KEY }} | ||
|
||
- name: Set Release Date | ||
run: | | ||
echo "release-date=$(TZ=Asia/Seoul date +'%Y-%m-%d')" >> $GITHUB_ENV | ||
- name: 최신 릴리즈 버전 조회 | ||
id: get-latest-release | ||
env: | ||
GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} | ||
run: | | ||
OLD_RELEASE=$(gh api \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
/repos/${{ env.owner }}/${{ env.repo }}/releases/latest) | ||
echo "old-release=${OLD_RELEASE}" >> $GITHUB_ENV | ||
continue-on-error: true | ||
|
||
- name: 릴리즈 버전 조회 실패 시 최초 릴리즈로 간주 | ||
if: ${{ steps.get-latest-release.outcome != 'success' }} | ||
run: | | ||
NEW_VERSION="v1.0.0" | ||
echo "new-version=${NEW_VERSION}" >> $GITHUB_ENV | ||
- name: 버전업 | ||
if: ${{ steps.get-latest-release.outcome == 'success' }} | ||
run: | | ||
OLD_VERSION=${{ fromJson(env.old-release).tag_name }} | ||
echo "OLD_VERSION: ${OLD_VERSION}" | ||
MAJOR=$(echo $OLD_VERSION | cut -d. -f1 | sed 's/v//') | ||
MINOR=$(echo $OLD_VERSION | cut -d. -f2) | ||
PATCH=$(echo $OLD_VERSION | cut -d. -f3) | ||
echo "major: $MAJOR, minor: $MINOR, patch: $PATCH" | ||
INCREMENT_TYPE=${{ inputs.VERSION_TO_UPGRADE }} | ||
if [ "$INCREMENT_TYPE" == "major" ]; then | ||
echo "upgrading major version" | ||
MAJOR=$((++MAJOR)) | ||
MINOR=0 | ||
PATCH=0 | ||
elif [ "$INCREMENT_TYPE" == "minor" ]; then | ||
echo "upgrading minor version" | ||
MINOR=$((++MINOR)) | ||
PATCH=0 | ||
elif [ "$INCREMENT_TYPE" == "patch" ]; then | ||
echo "upgrading patch version" | ||
PATCH=$((++PATCH)) | ||
else | ||
echo "Invalid increment type!" | ||
exit 1 | ||
fi | ||
echo "NEW_VERSION: v$MAJOR.$MINOR.$PATCH" | ||
NEW_VERSION="v$MAJOR.$MINOR.$PATCH" | ||
echo "new-version=${NEW_VERSION}" >> $GITHUB_ENV | ||
- name: 버전업 태그 생성 | ||
env: | ||
GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} | ||
run: | | ||
NEW_RELEASE=$(gh api \ | ||
--method POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
/repos/${{ env.owner }}/${{ env.repo }}/releases \ | ||
-f tag_name=${{ env.new-version }} \ | ||
-f target_commitish='main' \ | ||
-f name=${{ env.new-version }} \ | ||
-f body='${{ env.new-version }} release') | ||
echo "new-release=${NEW_RELEASE}" >> $GITHUB_ENV |
Oops, something went wrong.