v0.0.23 #36
Workflow file for this run
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: Publish Reviewzip | |
on: | |
release: | |
types: [published] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# JDK ์ค์น | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
#์๋ธ ๋ชจ๋ ์ ๊ทผ | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.PERSONAL_TOKEN }} | |
submodules: true | |
# ์๋ธ ๋ชจ๋ ๋ณ๊ฒฝ ์ ์์ผ๋ฉด update | |
- name: Git Submodule Update | |
run: | | |
git submodule update --remote --recursive | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{env.REGISTRY}} | |
username: ${{github.actor}} | |
password: ${{secrets.PERSONAL_TOKEN}} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{env.REGISTRY}}/${{env.IMAGE_NAME}} | |
# gradlew ๊ถํ ๋ณ๊ฒฝ | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
# ๋น๋(test๋ ์ ์ธ) | |
- name: Build with Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: clean build -x test | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
code-deploy: | |
needs: build-and-push-image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Access to server and Run container | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SERVER_IP }} | |
username: ${{ secrets.SERVER_USER }} | |
password: ${{ secrets.SSH_PASSWORD }} | |
script: | | |
cd reviewzip-server | |
docker-compose down | |
docker-compose rm | |
docker rmi ${{ secrets.IMAGE_NAME }} | |
docker pull ${{ secrets.IMAGE_NAME }} | |
docker-compose up -d |