Skip to content

Kerdy Backend Dev Server CI/CD #21

Kerdy Backend Dev Server CI/CD

Kerdy Backend Dev Server CI/CD #21

name: Kerdy Backend Dev Server CI/CD
on:
workflow_dispatch:
permissions:
contents: read
jobs:
build-and-upload:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: backend/emm-sale
services:
mysql:
image: mysql:8.0.28
env:
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: 1234
MYSQL_DATABASE: kerdy
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: 백엔드 메인으로 checkout
uses: actions/checkout@v3
with:
ref: backend-main
- name: JDK 11로 설정
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'temurin'
- name: Gradle에 실행 권한 부여
run: chmod +x gradlew
- name: Gradle 캐싱
id: cache-gradle
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: keystore 생성
id: generate-keystore
run: |
echo "$KEY_STORE" > keystore.b64
base64 -d -i keystore.b64 > keystore.p12
- name: keystore 이동
id: cp-keystore
run: |
cp keystore.p12 src/main/resources/ssl
- name: gradle 빌드
run: ./gradlew clean build
- name: 디버깅용 경로 출력
id: cp-keystore

Check failure on line 66 in .github/workflows/backend-dev-deploy.yml

View workflow run for this annotation

GitHub Actions / Kerdy Backend Dev Server CI/CD

Invalid workflow file

The workflow is not valid. .github/workflows/backend-dev-deploy.yml (Line: 66, Col: 13): The identifier 'cp-keystore' may not be used more than once within the same scope.
run: |
pwd
- name: jar artifact에 업로드
uses: actions/upload-artifact@v3
with:
name: BackendApplicationJar
path: backend/emm-sale/build/libs/*.jar
deploy:
runs-on: self-hosted
needs: build-and-upload
steps:
- name: 구버전 jar 삭제
run: rm -rf /home/ubuntu/backend/build/emm-sale-*.jar
- name: artifact에서 jar파일 다운 받기
uses: actions/download-artifact@v3
with:
name: BackendApplicationJar
path: /home/ubuntu/backend/build/
- name: 배포하기
run: /home/ubuntu/backend/build/deploy.sh
- name: 슬랙 메시지 보내기
uses: 8398a7/action-slack@v3
with:
mention: 'here'
if_mention: failure
status: ${{ job.status }}
fields: workflow,job,commit,message,ref,author,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()