[release] v1.1.0 릴리즈 #54
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: prod-CI | |
on: | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
prod-ci: | |
# Using Environment - prod 환경 | |
environment: prod | |
# 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-prod.yml | |
env: | |
PROD_DB_URL: ${{ secrets.PROD_DB_URL }} | |
PROD_DB_USERNAME: ${{ secrets.PROD_DB_USERNAME }} | |
PROD_DB_PASSWORD: ${{ secrets.PROD_DB_PASSWORD }} | |
PROD_JWT_SECRET: ${{ secrets.PROD_JWT_SECRET }} | |
PROD_KAKAO_CLIENT_ID: ${{ secrets.PROD_KAKAO_CLIENT_ID }} | |
PROD_KAKAO_CLIENT_SECRET: ${{ secrets.PROD_KAKAO_CLIENT_SECRET }} | |
PROD_KAKAO_REDIRECT_URI: ${{ secrets.PROD_KAKAO_REDIRECT_URI }} | |
PROD_REDIS_HOST: ${{ secrets.PROD_REDIS_HOST }} | |
PROD_S3_ACCESS_KEY: ${{ secrets.PROD_S3_ACCESS_KEY }} | |
PROD_S3_SECRET_KEY: ${{ secrets.PROD_S3_SECRET_KEY }} | |
PROD_COOLSMS_KEY: ${{ secrets.PROD_COOLSMS_KEY }} | |
PROD_COOLSMS_NUMBER: ${{ secrets.PROD_COOLSMS_NUMBER }} | |
PROD_COOLSMS_SECRET: ${{ secrets.PROD_COOLSMS_SECRET }} | |
PROD_ACCESS_TOKEN_EXPIRE_TIME: ${{ secrets.PROD_ACCESS_TOKEN_EXPIRE_TIME }} | |
PROD_REFRESH_TOKEN_EXPIRE_TIME: ${{ secrets.PROD_REFRESH_TOKEN_EXPIRE_TIME }} | |
PROD_ALLOWED_ORIGINS: ${{ secrets.PROD_ALLOWED_ORIGINS }} | |
PROD_SERVER_URL: ${{ secrets.PROD_SERVER_URL }} | |
run: | | |
cd ./src/main/resources | |
envsubst < application-prod.yml > application-prod.tmp.yml && mv application-prod.tmp.yml application-prod.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.PROD_DOCKER_LOGIN_USERNAME }} | |
password: ${{ secrets.PROD_DOCKER_LOGIN_ACCESSTOKEN }} | |
# Build and push Docker image - Docker image 빌드 및 푸시 | |
- name: Build and push Docker image | |
run: | | |
docker build --platform linux/amd64 -t donghoon0203/beat-prod . | |
docker push donghoon0203/beat-prod | |
# Trigger Jenkins job - Jenkins 작업 트리거 | |
- name: Trigger Jenkins job | |
uses: appleboy/jenkins-action@master | |
with: | |
url: ${{ secrets.PROD_WEBHOOK_URL }} | |
user: "beat" | |
token: ${{ secrets.PROD_JENKINS_API_TOKEN }} | |
job: "beat-project" |