Skip to content

Merge pull request #388 from read-a-perfume/renovate/org.projectlombo… #9

Merge pull request #388 from read-a-perfume/renovate/org.projectlombo…

Merge pull request #388 from read-a-perfume/renovate/org.projectlombo… #9

name: Backend develop CI/CD
on:
push:
branches:
- develop
permissions:
contents: read
jobs:
build-and-upload:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 19
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '19'
- name: Give permission for Gradle
run: chmod +x gradlew
- name: Cache Gradle
id: cache-gradle
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build with Gradle
run: ./gradlew :perfume-core:clean :perfume-api:clean :perfume-api:bootJar
- name: Upload jar file to artifact
uses: actions/upload-artifact@v3
with:
name: BackendApplication
path: perfume-api/build/libs/perfume-api-0.0.1.jar
deploy:
runs-on: [ self-hosted, dev ]
needs: build-and-upload
steps:
- name: Delete old jar file
run: rm -rf /home/ubuntu/backend/build/*.jar
- name: Download jar file from artifact
uses: actions/download-artifact@v3
with:
name: BackendApplication
path: /home/ubuntu/backend/build/
- name: 배포하기
run: sh /home/ubuntu/backend/deploy.sh
- name: 슬랙 메시지 보내기
uses: 8398a7/action-slack@v3
with:
mention: 'here'
if_mention: always
status: ${{ job.status }}
fields: workflow,job,commit,message,ref,author,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()