Skip to content

Update backend-deploy.yml #10

Update backend-deploy.yml

Update backend-deploy.yml #10

name: ๋ฐฑ์—”๋“œ ๋ฐฐํฌ
on:
push:
branches: [BE/chore/docker-test-2]
defaults:
run:
working-directory: backend
permissions:
checks: write
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: ์ฒดํฌ์•„์›ƒ
uses: actions/checkout@v3
with:
token: ${{ secrets.ACTION_TOKEN }}
submodules: recursive
- name: JDK17 ์„ค์น˜
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- name: Gradle์— ๊ถŒํ•œ๋ถ€์—ฌ
run: chmod +x gradlew
- name: Test ๋ฐ ๋นŒ๋“œ ์‹คํ–‰
run: ./gradlew build
- name: ๋„์ปค ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ ์„ค์ •
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: yigongil/spring
tag-semver: |
{{version}}
{{major}}.{{minor}}
- name: ๋„์ปค ํ—ˆ๋ธŒ ๋กœ๊ทธ์ธ
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: ๋„์ปค ์ด๋ฏธ์ง€ ๋นŒ๋“œ ํ›„ ํ—ˆ๋ธŒ์— ์—…๋กœ๋“œ
uses: docker/build-push-action@v2
with:
context: .
file: ./backend/Dockerfile
platforms: linux/amd64
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
deploy:
runs-on: self-hosted
if: ${{ needs.docker-build.result == 'success' }}
needs: [ build-and-push ]
steps:
- name: ๋„์ปค ํ’€ / ํŒŒ์ผ ์‹คํ–‰
run: |
sudo ~/deploy.sh