From 1849e192edf6828453dadc6e1bafcafdab45f36b Mon Sep 17 00:00:00 2001 From: kseysh Date: Wed, 29 May 2024 14:19:09 +0900 Subject: [PATCH 1/2] =?UTF-8?q?deploy=20-=20#145=20codedeploy=20shell=20sc?= =?UTF-8?q?ript=20=ED=99=98=EA=B2=BD=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/start.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/script/start.sh b/script/start.sh index 1cf49ca4..abc9f911 100644 --- a/script/start.sh +++ b/script/start.sh @@ -1,12 +1,8 @@ # 인스턴스에 클론 받은 디렉토리 이름을 `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) @@ -20,7 +16,15 @@ JAR_PID=$(pgrep -f $JAR_NAME) fi echo "> $JAR_PATH 배포" #3 - # shellcheck disable=SC2153 - # shellcheck disable=SC2024 + source ~/.bashrc - sudo nohup java -jar -Dspring.profiles.active=prod "$JAR_PATH" >nohup.out 2>&1 nohup.out 2>&1 nohup.out 2>&1 Date: Wed, 29 May 2024 14:20:02 +0900 Subject: [PATCH 2/2] =?UTF-8?q?deploy=20-=20#145=20ci=20=ED=94=8C=EB=A1=9C?= =?UTF-8?q?=EC=9A=B0=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/hmh-cd-prod.yml | 2 +- .../workflows/{hmh-ci.yml => hmh-ci-dev.yml} | 2 - .github/workflows/hmh-ci-prod.yml | 40 +++++++++++++++++++ 3 files changed, 41 insertions(+), 3 deletions(-) rename .github/workflows/{hmh-ci.yml => hmh-ci-dev.yml} (96%) create mode 100644 .github/workflows/hmh-ci-prod.yml diff --git a/.github/workflows/hmh-cd-prod.yml b/.github/workflows/hmh-cd-prod.yml index 0ca6ee51..3353b393 100644 --- a/.github/workflows/hmh-cd-prod.yml +++ b/.github/workflows/hmh-cd-prod.yml @@ -49,7 +49,7 @@ jobs: aws-region: ${{ secrets.AWS_REGION }} - name: 🚀 s3 upload - run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.zip s3://${{matrix.s3-bucket}}/prod/deploy/$GITHUB_SHA.zip # 수정 고려 + run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.zip s3://${{matrix.s3-bucket}}/prod/deploy/$GITHUB_SHA.zip - name: ☀️ CodeDeploy~! run: aws deploy create-deployment diff --git a/.github/workflows/hmh-ci.yml b/.github/workflows/hmh-ci-dev.yml similarity index 96% rename from .github/workflows/hmh-ci.yml rename to .github/workflows/hmh-ci-dev.yml index eedf0287..8648100a 100644 --- a/.github/workflows/hmh-ci.yml +++ b/.github/workflows/hmh-ci-dev.yml @@ -3,8 +3,6 @@ name: 🏭 APPLICATION-BUILD! on: pull_request: branches: [ "develop" ] - push: - branches: [ "develop" ] permissions: contents: read diff --git a/.github/workflows/hmh-ci-prod.yml b/.github/workflows/hmh-ci-prod.yml new file mode 100644 index 00000000..c9aa1877 --- /dev/null +++ b/.github/workflows/hmh-ci-prod.yml @@ -0,0 +1,40 @@ +name: 🏭 APPLICATION-BUILD! + +on: + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: checkout + uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'corretto' + + - name: Copy application.yml + run: | + mkdir ./src/main/resources + touch ./src/main/resources/application.yml + + echo "${{ secrets.APPLICATION_PROD_YML }}" >> ./src/main/resources/application.yml + + cat ./src/main/resources/application.yml + shell: bash + + - name: Grant execute permission for gradlew + run: | + chmod +x gradlew + + - name: Build with Gradle + run: | + ./gradlew clean build \ No newline at end of file