From 75cbb0c5b98a9b0eb48dba542e217b2022963a87 Mon Sep 17 00:00:00 2001 From: Park Hyeongmin Date: Thu, 25 Jul 2024 13:50:29 +0900 Subject: [PATCH] =?UTF-8?q?THT-Server-244=20[Admin]=20=EC=96=B4=EB=93=9C?= =?UTF-8?q?=EB=AF=BC=20=EB=AA=A8=EB=93=88=20ci-cd=20=EA=B5=AC=EC=B6=95=20(?= =?UTF-8?q?#245)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workflows/ADMIN-Server-gradle-publish.yml | 77 +++++++++++++++++++ ...lish.yml => APP-Server-gradle-publish.yml} | 11 +-- 2 files changed, 80 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/ADMIN-Server-gradle-publish.yml rename .github/workflows/{gradle-publish.yml => APP-Server-gradle-publish.yml} (94%) diff --git a/.github/workflows/ADMIN-Server-gradle-publish.yml b/.github/workflows/ADMIN-Server-gradle-publish.yml new file mode 100644 index 00000000..7f05f842 --- /dev/null +++ b/.github/workflows/ADMIN-Server-gradle-publish.yml @@ -0,0 +1,77 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created +# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle + +name: THT ADMIN SERVER +run-name: ${{ github.actor }} is learning GitHub Actions + +on: + pull_request: + types: + - closed + branches: + - main + +env: + AWS_CODE_DEPLOY_APPLICATION: THT-ApiServer-GitAction + AWS_CODE_DEPLOY_GROUP: THT-ApiServer-GitAction-SingleServer + +jobs: + build: + runs-on: ubuntu-latest + if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'admin') + + permissions: + contents: read + packages: write + + steps: + - name: CheckOut + uses: actions/checkout@v4 + with: + token: ${{ secrets.GIT_TOKEN }} + submodules: true + + - name: Set up JDK 17 + uses: + actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + server-id: github # Value of the distributionManagement/repository/id field of the pom.xml + settings-path: ${{ github.workspace }} # location for the settings.xml file + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@ec92e829475ac0c2315ea8f9eced72db85bb337a # v3.0.0 + + - name : set time zone + uses: szenius/set-timezone@v1.2 + with: + timezoneLinux: "Asia/Seoul" + timezoneMacos: "Asia/Seoul" + timezoneWindows: "Seoul Standard Time" + + - name: Cache with Gradle + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ github.repository }}-gradle-${{ hashFiles('**/*.gradle*') }} + restore-keys: | + ${{ github.repository }}-gradle- + + - name: Build with Gradle + run: ./gradlew clean tht-admin:clean tht-admin:build + + - name: make env now date + id: now + run: echo "date=`date +%Y%m%d_%H:%M:%S`" >> "$GITHUB_OUTPUT" + + - name: Make Zip File + id: file + run: zip -qq -r ./deployfile-${{ steps.now.outputs.date }}.zip . + shell: bash diff --git a/.github/workflows/gradle-publish.yml b/.github/workflows/APP-Server-gradle-publish.yml similarity index 94% rename from .github/workflows/gradle-publish.yml rename to .github/workflows/APP-Server-gradle-publish.yml index 2e11bbef..af0163aa 100644 --- a/.github/workflows/gradle-publish.yml +++ b/.github/workflows/APP-Server-gradle-publish.yml @@ -10,15 +10,10 @@ run-name: ${{ github.actor }} is learning GitHub Actions on: pull_request: + types: + - closed branches: - main - paths: - - 'tht-apis/**' - push: - branches: - - main - paths: - - 'tht-apis/**' env: AWS_CODE_DEPLOY_APPLICATION: THT-ApiServer-GitAction @@ -27,7 +22,7 @@ env: jobs: build: runs-on: ubuntu-latest - if: contains(github.event.pull_request.labels.*.name, 'app') + if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'app') permissions: contents: read