Skip to content

Merge pull request #84 from Jhsysng/main #60

Merge pull request #84 from Jhsysng/main

Merge pull request #84 from Jhsysng/main #60

Workflow file for this run

name: ✨ REINPUT backend DEV CD ✨
env:
PROFILE: prod
DOCKER_HUB_REPOSITORY: ahchjang/reinput # docker μ„€μ •ν•  것
on:
workflow_dispatch:
push:
branches:
- main
paths:
- "/**"
- "src/**"
- ".github/workflows/reinput.yml"
jobs:
backend-docker-build-and-push:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./
steps:
- name: ✨ Checkout repository
uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.ACTION_TOKEN }}
- name: ✨ JDK 17 μ„€μ •
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: ✨ Gradle Caching
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: ✨ Gradlew κΆŒν•œ μ„€μ •
run: chmod +x ./gradlew
- name: ✨ Jar 파일 λΉŒλ“œ
run: ./gradlew bootJar
- name: ✨ DockerHub에 둜그인
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: ✨ Docker Image λΉŒλ“œ ν›„ DockerHub에 Push
uses: docker/build-push-action@v4
with:
context: ./
file: ./Dockerfile
push: true
platforms: linux/amd64
tags: ${{ env.DOCKER_HUB_REPOSITORY }}:latest
build-args: |
SPRING_PROFILES_ACTIVE=${{ env.PROFILE }}
backend-docker-pull-and-run:
runs-on: [ self-hosted, dev ]
if: ${{ needs.backend-docker-build-and-push.result == 'success' }}
needs: [ backend-docker-build-and-push ]
steps:
- name: ✨ 배포 슀크립트 μ‹€ν–‰
run: |
sh /home/ubuntu/deploy.sh