[FIX] 이모티콘 추가 #360
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: CD Pipeline using Docker Hub | |
on: | |
push: | |
branches: [ "develop" ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
- 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- | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Set up yml secrets file | |
env: | |
YAML_SECRET: ${{ secrets.YML_SECRET }} | |
APPLE_SECRET: ${{ secrets.APPLE_SECRET }} | |
FCM_JSON_SECRET: ${{ secrets.FCM_JSON_SECRET }} | |
YAML_DIR: src/main/resources | |
FCM_FILE_NAME: plub-firebase-private-key.json | |
YAML_FILE_NAME: application-secret-prod.yml | |
APPLE_FILE_NAME: apple_sign_key.p8 | |
run: echo $YAML_SECRET | base64 --decode > $YAML_DIR/$YAML_FILE_NAME && | |
echo $APPLE_SECRET > $YAML_DIR/$APPLE_FILE_NAME && | |
echo $FCM_JSON_SECRET > $YAML_DIR/$FCM_FILE_NAME | |
- name: Make application-password.yml | |
env: | |
PROPERTIES_TEST: ${{ secrets.PROPERTIES_TEST }} | |
YAML_DIR: src/main/resources | |
PASSWORD_FILE_NAME: application-password.yml | |
run: echo $PROPERTIES_TEST | base64 --decode > $YAML_DIR/$PASSWORD_FILE_NAME | |
- name: Build with Gradle | |
run: ./gradlew bootJar | |
## 3) Docker Hub에 이미지 push 하기 | |
- name: Docker build | |
run: | | |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
docker build -t ${{ secrets.DOCKER_USERNAME }}/plub-server . | |
docker tag ${{ secrets.DOCKER_USERNAME }}/plub-server ${{ secrets.DOCKER_USERNAME }}/plub-server:${GITHUB_SHA::7} | |
docker push ${{ secrets.DOCKER_USERNAME }}/plub-server:${GITHUB_SHA::7} | |
## 4) Docker Hub에 Push한 이미지를 리눅스 서버에 받아와서 run | |
- name: Deploy | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.EC2_IP }} | |
username: ubuntu | |
key: ${{ secrets.EC2_PEM_KEY }} | |
envs: GITHUB_SHA | |
script: | | |
docker pull ${{ secrets.DOCKER_USERNAME }}/plub-server:${GITHUB_SHA::7} | |
docker tag ${{ secrets.DOCKER_USERNAME }}/plub-server:${GITHUB_SHA::7} plub-server | |
docker rm -f $(docker ps -qa) | |
docker run -d --name server -e JAVA_OPTS=-Djasypt.encryptor.password=${{ secrets.YML_PASSWORD }} -e TZ=Asia/Seoul -e ENVIRONMENT_VALUE=-Dspring.profiles.active=secret-prod -p 8080:8085 plub-server |