-
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
Showing
34 changed files
with
564 additions
and
332 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
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,60 @@ | ||
name: Blue Green Deployment | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
self_hosted_runner: | ||
description: 'self hosted runner label' | ||
required: true | ||
type: string | ||
artifact_name: | ||
description: 'uploaded artifact name' | ||
required: true | ||
type: string | ||
jar_name: | ||
description: 'uploaded jar name' | ||
required: true | ||
type: string | ||
profile: | ||
description: 'profile' | ||
required: true | ||
type: string | ||
app_path: | ||
description: 'app path' | ||
required: true | ||
type: string | ||
outputs: | ||
green_port: | ||
value: ${{ jobs.deploy-green.outputs.green_port }} | ||
blue_port: | ||
value: ${{ jobs.deploy-green.outputs.blue_port }} | ||
|
||
jobs: | ||
deploy-green: | ||
runs-on: ${{ inputs.self_hosted_runner }} | ||
outputs: | ||
green_port: ${{ steps.blue_green_port.outputs.green_port }} | ||
blue_port: ${{ steps.blue_green_port.outputs.blue_port }} | ||
steps: | ||
- name: Download artifact file | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ inputs.artifact_name }} | ||
path: ${{ inputs.app_path }} | ||
|
||
- name: Change permission of shell script | ||
run: chmod +x ${{ inputs.app_path }}/*.sh | ||
|
||
- name: Get blue green port | ||
id: blue_green_port | ||
run: ${{ inputs.app_path }}/get_blue_green_port.sh | awk '{print $0}' >> $GITHUB_OUTPUT | ||
|
||
- name: Run green java application in ${{ inputs.self_hosted_runner }} | ||
run: sudo nohup java -Dspring.profiles.active=${{ inputs.profile }} -Dserver.port=${{ steps.blue_green_port.outputs.green_port }} -Duser.timezone=Asia/Seoul -jar ${{ inputs.app_path }}/${{ inputs.jar_name }} & | ||
|
||
health_check: | ||
needs: [ deploy-green ] | ||
runs-on: ${{ inputs.self_hosted_runner }} | ||
steps: | ||
- name: Health check green | ||
run: ${{ inputs.app_path }}/green_health_check.sh ${{ needs.deploy-green.outputs.green_port }} |
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,68 @@ | ||
name: backend build jar file and upload artifact file | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
profile: | ||
description: 'profile' | ||
required: true | ||
type: string | ||
artifact_name: | ||
description: 'artifact name' | ||
default: 'app-artifact' | ||
required: false | ||
type: string | ||
jar_name: | ||
description: 'jar name' | ||
default: 'app.jar' | ||
required: false | ||
type: string | ||
gradlew_options: | ||
description: 'gradle options' | ||
required: false | ||
type: string | ||
secrets: | ||
secret_yml: | ||
description: 'secret yml' | ||
required: true | ||
outputs: | ||
artifact_name: | ||
value: ${{ inputs.artifact_name }} | ||
jar_name: | ||
value: ${{ inputs.jar_name }} | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ./backend | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setting ${{ inputs.profile }}-secret.yml | ||
run: | | ||
echo "${{ secrets.secret_yml }}" > ./src/main/resources/${{ inputs.profile }}-secret.yml | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
|
||
- name: BootJar with Gradle | ||
run: ./gradlew bootJar ${{ inputs.gradlew_options }} | ||
|
||
- name: Move artifact file # todo script 환경 분리 | ||
run: | | ||
mkdir -p ${{ inputs.artifact_name }} && \ | ||
mv build/libs/*.jar ${{ inputs.artifact_name }}/${{ inputs.jar_name }} && \ | ||
mv scripts/* ${{ inputs.artifact_name }}/ | ||
- name: Upload artifact file | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ inputs.artifact_name }} | ||
path: ./backend/${{ inputs.artifact_name }} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.