Skip to content

[HOTFIX] #254 - Jenkinsfile의 scp 방식을 sshPut 방식으로 재변경 #179

[HOTFIX] #254 - Jenkinsfile의 scp 방식을 sshPut 방식으로 재변경

[HOTFIX] #254 - Jenkinsfile의 scp 방식을 sshPut 방식으로 재변경 #179

Workflow file for this run

name: dev-CI
on:
pull_request:
branches: [ "develop" ]
jobs:
dev-ci:
# Using Environment - dev 환경
environment: dev
# Operating system - ubuntu-22.04
runs-on: ubuntu-22.04
permissions:
contents: read
steps:
# Checkout - 가상 머신에 체크아웃
- name: Checkout code
uses: actions/checkout@v3
# JDK setting - JDK 17 설정
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
# gradle caching - 빌드 시간 향상
- name: Gradle Caching
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
# Inject environment variables - 환경 변수를 yml 파일에 주입
- name: Inject environment variables into application-dev.yml
env:
DEV_DB_URL: ${{ secrets.DEV_DB_URL }}
DEV_DB_USERNAME: ${{ secrets.DEV_DB_USERNAME }}
DEV_DB_PASSWORD: ${{ secrets.DEV_DB_PASSWORD }}
DEV_JWT_SECRET: ${{ secrets.DEV_JWT_SECRET }}
DEV_KAKAO_CLIENT_ID: ${{ secrets.DEV_KAKAO_CLIENT_ID }}
DEV_KAKAO_CLIENT_SECRET: ${{ secrets.DEV_KAKAO_CLIENT_SECRET }}
DEV_KAKAO_REDIRECT_URI: ${{ secrets.DEV_KAKAO_REDIRECT_URI }}
DEV_REDIS_HOST: ${{ secrets.DEV_REDIS_HOST }}
DEV_S3_ACCESS_KEY: ${{ secrets.DEV_S3_ACCESS_KEY }}
DEV_S3_SECRET_KEY: ${{ secrets.DEV_S3_SECRET_KEY }}
DEV_COOLSMS_KEY: ${{ secrets.DEV_COOLSMS_KEY }}
DEV_COOLSMS_NUMBER: ${{ secrets.DEV_COOLSMS_NUMBER }}
DEV_COOLSMS_SECRET: ${{ secrets.DEV_COOLSMS_SECRET }}
DEV_ACCESS_TOKEN_EXPIRE_TIME: ${{ secrets.DEV_ACCESS_TOKEN_EXPIRE_TIME }}
DEV_REFRESH_TOKEN_EXPIRE_TIME: ${{ secrets.DEV_REFRESH_TOKEN_EXPIRE_TIME }}
DEV_ALLOWED_ORIGINS: ${{ secrets.DEV_ALLOWED_ORIGINS }}
DEV_SERVER_URL: ${{ secrets.DEV_SERVER_URL }}
run: |
cd ./src/main/resources
envsubst < application-dev.yml > application-dev.tmp.yml && mv application-dev.tmp.yml application-dev.yml
# gradle build - 테스트 없이 gradle 빌드
- name: Build with Gradle
run: |
chmod +x gradlew
./gradlew build -x test
shell: bash
# Set up Docker Buildx - Docker Buildx 설치
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.9.1
# Log in to Docker Hub - Docker Hub 로그인
- name: Log in to Docker Hub
uses: docker/login-action@v2.2.0
with:
username: ${{ secrets.DEV_DOCKER_LOGIN_USERNAME }}
password: ${{ secrets.DEV_DOCKER_LOGIN_ACCESSTOKEN }}
# Build and push Docker image - Docker image 빌드 및 푸시
- name: Build and push Docker image
run: |
docker build -f Dockerfile-dev --platform linux/amd64 -t hoonyworld/beat-dev .
docker push hoonyworld/beat-dev
# # Trigger Jenkins job - Jenkins 작업 트리거
# - name: Trigger Jenkins job
# uses: appleboy/jenkins-action@master
# with:
# url: ${{ secrets.DEV_WEBHOOK_URL }}
# user: "beat"
# token: ${{ secrets.DEV_JENKINS_API_TOKEN }}
# job: "beat-project"