-
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.
Merge pull request #1 from SOPT-33-iOS-Team-1/chore/#0-init-github-fe…
…ature github 기능 활용을 위한 기본적인 폴더와 파일들 생성
- Loading branch information
Showing
8 changed files
with
153 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Empty file.
Empty file.
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,59 @@ | ||
name: 🚀 SKT-T1-APPLICATION-DEPLOY! | ||
|
||
on: | ||
push: | ||
branches: [ 'main' ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
codedeploy-application-name: [ skt-t1-app ] | ||
deployment-group-name: [ skt-t1-app-deploy-group ] | ||
s3-bucket: [ skt-t1-app ] | ||
|
||
|
||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'corretto' | ||
java-version: '17' | ||
|
||
- name: mkdir resources folder | ||
run: touch ./src/main/resources/application.yml | ||
shell: bash | ||
|
||
- name: copy yaml file | ||
run: echo "${{ secrets.APPLICATION_YML }}" > ./src/main/resources/application.yml | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: 🐈 Gradle Build | ||
run: ./gradlew clean build | ||
|
||
- name: 📂 Make zip file | ||
run: zip -r ./$GITHUB_SHA.zip . | ||
|
||
- name: 🪣 S3 upload | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY }} | ||
aws-region: ap-northeast-2 | ||
|
||
- name: 🚀 s3 upload | ||
run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.zip s3://${{matrix.s3-bucket}}/deploy/$GITHUB_SHA.zip | ||
|
||
- name: ☀️ CodeDeploy~! | ||
run: aws deploy create-deployment | ||
--application-name ${{matrix.codedeploy-application-name}} | ||
--deployment-group-name ${{matrix.deployment-group-name}} | ||
--s3-location bucket=${{matrix.s3-bucket}},bundleType=zip,key=deploy/$GITHUB_SHA.zip | ||
--file-exists-behavior OVERWRITE | ||
--region ap-northeast-2 |
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,49 @@ | ||
name: 🏭 SKT-T1-APPLICATION-BUILD! | ||
|
||
# 해당 Action이 실행되는 Trigger | ||
on: | ||
pull_request: | ||
branches: [ "dev" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
# 1) 워크플로우 실행 전 기본적으로 체크아웃 필요 | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
# 2) JDK 11버전 설치, 다른 JDK 버전을 사용하다면 수정 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'corretto' | ||
|
||
# 3) 환경변수 파일 생성 | ||
- name: Copy application-local.yml | ||
run: | | ||
# application.yml 생성 | ||
touch ./src/main/resources/application.yml | ||
# application.yml 파일 값 입력 | ||
echo "${{ secrets.APPLICATION_YML }}" >> ./src/main/resources/application.yaml | ||
# application.yaml 파일 확인 | ||
cat ./src/main/resources/application.yaml | ||
shell: bash | ||
|
||
# 이 워크플로우는 gradle build | ||
- name: Grant execute permission for gradlew | ||
run: | | ||
chmod +x gradlew | ||
- name: Build with Gradle | ||
run: | | ||
./gradlew build -x test |
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,15 @@ | ||
version: 0.0 | ||
os: linux | ||
|
||
files: | ||
- source: / | ||
destination: /home/ubuntu/app | ||
hooks: | ||
ApplicationStop: | ||
- location: script/stop.sh | ||
timeout: 60 | ||
runas: root | ||
AfterInstall: | ||
- location: script/start.sh | ||
timeout: 60 | ||
runas: root |
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,25 @@ | ||
# 인스턴스에 클론 받은 디렉토리 이름을 `app`으로 바꿔야합니다. | ||
APPLICATION_PATH=/home/ubuntu/app | ||
# shellcheck disable=SC2164 | ||
cd $APPLICATION_PATH | ||
|
||
# shellcheck disable=SC2010 | ||
JAR_NAME=$(ls $APPLICATION_PATH/build/libs/ | grep '.jar' | tail -n 1) | ||
|
||
# shellcheck disable=SC2034 | ||
JAR_PATH=build/libs/$JAR_NAME | ||
JAR_PID=$(pgrep -f $JAR_NAME) | ||
|
||
if [ -z $JAR_PID ] | ||
then | ||
echo "> 현재 구동중인 애플리케이션이 없으므로 종료하지 않습니다." | ||
else | ||
echo "> sudo kill -15 $JAR_PID" | ||
sudo kill -15 $JAR_PID | ||
sleep 10 | ||
fi | ||
|
||
echo "> $JAR_PATH 배포" #3 | ||
# shellcheck disable=SC2153 | ||
# shellcheck disable=SC2024 | ||
sudo nohup java -jar -Dspring.profiles.active=prod "$JAR_PATH" >nohup.out 2>&1 </dev/null & |
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,5 @@ | ||
#!/bin/bash | ||
# shellcheck disable=SC2046 | ||
# shellcheck disable=SC2009 | ||
kill $(ps aux | grep java | grep -v grep | awk '{print $2}') | ||
echo "java stopped" |