feat: 이동 기능 완성! #48
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: 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 |