Skip to content

Deploy 1.3.3

Deploy 1.3.3 #48

Workflow file for this run

name: CD with Gradle
on:
pull_request:
branches:
- main
types:
- closed
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest # ubuntu 최신 버전에서 script를 실행
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: "adopt"
- name: Set Sentry auth token
run: |
echo "export SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}" >> $GITHUB_ENV
- name: Make application.yml
run: |
mkdir -p src/main/resources
echo "${{ secrets.PROPERTIES }}" > src/main/resources/application-prod.yml
- name: Build with Gradle
run: |
chmod +x ./gradlew
./gradlew clean build -x test
- name: Docker build & push to docker repo
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -f Dockerfile -t ${{ secrets.DOCKER_REPO }} .
docker push ${{ secrets.DOCKER_REPO }}
- name: Deploy to server
uses: appleboy/ssh-action@master
id: deploy
with:
host: ${{ secrets.HOST }}
username: ubuntu
key: ${{ secrets.KEY }}
script: |
sudo docker rm -f $(sudo docker ps -qa)
sudo docker pull ${{ secrets.DOCKER_REPO }}
sudo docker-compose up -d
sudo docker image prune -f