Skip to content

feat: all api완성 #43

feat: all api완성

feat: all api완성 #43

Workflow file for this run

name: Java CI with Gradle
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
build-docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name : Setup Environment
run : |
echo -e "\n${{ secrets.APPLICATION }}" >> ./src/main/resources/application.properties
- name: Setup JDK 21
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '21'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Set up Docker
uses: docker/setup-buildx-action@v3
- name: Login to ghcr
uses: docker/login-action@v3
with:
registry: ghcr.io
username: yunuo46
password: ${{ secrets.GHCR_TOKEN }}
- name: docker Build and Push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ghcr.io/yunuo46/getaguitar:latest
deploy-docker:
needs: build-docker
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Deploy to Server via SSH
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
echo ${{ secrets.GHCR_TOKEN }} | docker login ghcr.io -u yunuo46 --password-stdin
docker pull ghcr.io/yunuo46/getaguitar:latest
docker stop getaguitar || true
docker rm getaguitar || true
docker run -d --name getaguitar -p 3000:3000 ghcr.io/yunuo46/getaguitar:latest