Skip to content

[deploy] 배포도중 발견한 문제 확인하고 deploy 스크립트 넣고 실행해보기 (#118) #5

[deploy] 배포도중 발견한 문제 확인하고 deploy 스크립트 넣고 실행해보기 (#118)

[deploy] 배포도중 발견한 문제 확인하고 deploy 스크립트 넣고 실행해보기 (#118) #5

Workflow file for this run

name: DEPLOY
on:
push:
branches:
- release/**
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Jdk 21
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '21'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Debug Secrets
run: |
echo "Secrets YML value:"
echo "${{ secrets.PROD_CONFIG }}"
- name: Push yml file
run: |
mkdir -p ./src/main/resources
ls -l
echo ${{ secrets.PROD_CONFIG }} > ./src/main/resources/application-prod.yml
echo "hello is yml file push success?"
cat ./src/main/resources/application-prod.yml
- name: Build with Gradle
run: ./gradlew -x test clean build
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and Push Docker Image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/ggang:latest .
docker push ${{ secrets.DOCKER_USERNAME }}/ggang:latest
- name: deploy appleboy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.PORT }}
script: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKERHUB_PASSWORD }}
docker pull ${{ secrets.DOCKER_USERNAME }}/ggang:latest
./deploy.sh
echo "now finished deploy: $(date '+%Y-%m-%d %H:%M:%S')" > deploy_success_date.txt