Merge pull request #184 from depromeet/fix/make-file #90
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
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created | |
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle | |
name: dev-fairer-batch | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ develop ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '11' | |
distribution: 'adopt' | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew # gradle wrapper를 실행할 수 있도록 권한 부여 | |
shell: bash | |
- name: Set timezone to Seoul | |
run: sudo timedatectl set-timezone Asia/Seoul | |
shell: bash | |
- name: JIB Build with Gradle | |
run: ./gradlew :fairer-batch:jib # 프로젝트 빌드 | |
shell: bash | |
- name: Get current time | |
uses: 1466587594/get-current-time@v2 # 빌드 완료 시간 가져오기 | |
id: current-time | |
with: | |
format: YYYY-MM-DD-HH-mm-ss | |
utcOffset: "+09:00" | |
- name: Show Current Time | |
run: echo "CurrentTime=${{steps.current-time.outputs.formattedTime}}" # 빌드 완료 시간 출력하기 | |
shell: bash | |
deploy: | |
needs: build | |
name: Deploy | |
runs-on: [ self-hosted, label-development ] | |
steps: | |
- name: Docker run | |
run: | | |
sudo docker ps -q --filter "name=fairer-batch-dev" | grep -q . && sudo docker stop "fairer-batch-dev" && sudo docker rmi "fairerbe/fairer-batch-dev:latest" | |
sudo docker run -d --name fairer-batch-dev --rm -p 8081:8081 fairerbe/fairer-batch-dev:latest |