Skip to content

Commit

Permalink
github actions 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
HwangHoYoon committed Dec 9, 2023
1 parent a737b85 commit e450888
Showing 1 changed file with 34 additions and 16 deletions.
50 changes: 34 additions & 16 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,48 @@
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle

name: Java CI with Gradle
name: Java CI with Gradle Docker

on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]
branches: [ "master" ]

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest
runs-on: self-hosted

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/gradle-build-action@bd5760595778326ba7f1441bcf7e88b49de61a25 # v2.6.0
with:
arguments: build
- name: checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.SUB_TOKEN }}
submodules: true

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew build -x test

- name: Docker build
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -t ${{ secrets.DOCKER_REPO }}/jagiyadocker .
docker push ${{ secrets.DOCKER_REPO }}/jagiyadocker
- name: Deploy
run: |
docker stop be-con || true
docker rm -f be-con || true
docker rmi $(docker images -f "dangling=true" -q) || true
docker pull ${{ secrets.DOCKER_REPO }}/jagiyadocker:latest
docker run -v /var/log/service:/var/log/service --name be-con -p 8080:8080 -d ${{ secrets.DOCKER_REPO }}/jagiyadocker:latest

0 comments on commit e450888

Please sign in to comment.