Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…eview-me into fe/reactor/373-review_writing_semantic
  • Loading branch information
BadaHertz52 committed Aug 16, 2024
2 parents 5af48f3 + 548b31f commit 5d9e72f
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: CD using Github self-hosted runner
name: [DEVELOP] CD using Github self-hosted runner

on:
workflow_dispatch:
push:
branches:
- main
- develop
paths:
- 'backend/**'
Expand Down Expand Up @@ -53,7 +52,7 @@ jobs:
deploy:
name: Deploy via self-hosted runner
needs: build
runs-on: self-hosted
runs-on: [self-hosted, dev]

steps:
- name: Checkout to secret repository
Expand Down
98 changes: 98 additions & 0 deletions .github/workflows/backend-prod-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: [RELEASE] CD using Github self-hosted runner

on:
workflow_dispatch:
push:
branches:
- release
paths:
- 'backend/**'

env:
ARTIFACT_NAME: review-me-prod
ARTIFACT_DIRECTORY: ./backend/build/libs
APPLICATION_DIRECTORY: ~/review-me-app

jobs:
build:
name: Build Jar file and upload artifact
runs-on: ubuntu-latest

steps:
- name: Checkout to current repository
uses: actions/checkout@v4

- name: Setup JDK Corretto using cached gradle dependencies
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 17
cache: 'gradle'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.8

- name: Build and test with gradle
run: |
cd ./backend
./gradlew clean bootJar
- name: Rename artifact file
run: |
mv ${{ env.ARTIFACT_DIRECTORY }}/*.jar ${{ env.ARTIFACT_DIRECTORY }}/${{ env.ARTIFACT_NAME }}.jar
- name: Upload created artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_DIRECTORY }}/${{ env.ARTIFACT_NAME }}.jar

deploy:
name: Deploy via self-hosted runner
needs: build
runs-on: [self-hosted, prod]

steps:
- name: Checkout to secret repository
uses: actions/checkout@v4
with:
repository: ${{ secrets.PRIVATE_REPOSITORY_URL }}
token: ${{ secrets.PRIVATE_REPOSITORY_TOKEN }}

- name: Download uploaded artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}

- name: Copy application related files to other directory
run: |
sudo mv * ${{ env.APPLICATION_DIRECTORY }}
- name: Find ${{ env.ARTIFACT_NAME }} process
run: |
echo "Checking processes..."
PID=$(pgrep -f ${{ env.ARTIFACT_NAME }}.jar -d " " || true)
if [ -n "$PID" ]; then
echo "Found processes: $PID"
echo "server_running=true" >> "$GITHUB_ENV"
echo "PID=$PID" >> "$GITHUB_ENV"
else
echo "Process not found!"
echo "server_running=false" >> "$GITHUB_ENV"
fi
- name: Stop server if available (gracefully)
if: env.server_running == 'true'
run: |
echo "Gracefully shutting down process ${{ env.PID }}"
for PID in ${{ env.PID }}; do
sudo kill -15 $PID | true
tail --pid=$PID -f /dev/null | true
done
- name: Start server
run: |
cd ${{ env.APPLICATION_DIRECTORY }}
sudo nohup java -jar ${{ env.ARTIFACT_NAME }}.jar --server.port=80 --spring.config.location=application-prod.yml &
1 change: 0 additions & 1 deletion frontend/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
href="https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap"
rel="stylesheet"
/>
<link href="https://hangeul.pstatic.net/hangeul_static/css/nanum-gothic.css" rel="stylesheet" />
<link
rel="stylesheet"
type="text/css"
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/styles/globalStyles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const globalStyles = css`
}
body {
font-family: 'Pretendard-Regular', 'NanumGothic', 'Noto Sans', sans-serif;
font-family: 'Pretendard-Regular', 'Noto Sans', sans-serif;
margin: 0;
padding: 0;
box-sizing: border-box;
Expand Down

0 comments on commit 5d9e72f

Please sign in to comment.