Skip to content

๐Ÿ‘ท[CD]:GitHub Actions, Docker ๋ฐฐํฌ ๊ด€๋ จ #27

๐Ÿ‘ท[CD]:GitHub Actions, Docker ๋ฐฐํฌ ๊ด€๋ จ

๐Ÿ‘ท[CD]:GitHub Actions, Docker ๋ฐฐํฌ ๊ด€๋ จ #27

Workflow file for this run

name: Java CI with Gradle & Docker
on:
push:
branches: [ "develop", "feat/*", "cicd/*", "fix/*", "hotfix/*", "refactor/*", "chore/*", "docs/*", "style/*", "test/*" ]
pull_request:
types : [ closed ]
workflow_dispatch: # ์ˆ˜๋™ ์‹คํ–‰ ๊ฐ€๋Šฅ
jobs:
build:
runs-on: ubuntu-latest
# develop ๊ธฐ๋ฐ˜ ๋ธŒ๋žœ์น˜๊ฐ€ PR์ด merge ๋์„ ๊ฒฝ์šฐ์—๋งŒ ์ง„ํ–‰
# ๊ฐœ๋ฐœ ์ดํ›„์— if ๋ฌธ ๋ถ™์ด๊ธฐ.. if๋ฌธ ์žˆ์œผ๋ฉด Status skipped ๋จ
# if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop'
steps:
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Checkout
uses: actions/checkout@v3
# Spring Boot ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ Build (1)
- name: Spring Boot Build
run: ./gradlew clean build -x test --warning-mode=all --stacktrace
# Docker ์ด๋ฏธ์ง€ Build (2)
- name: docker image build
run: docker build -t rimi3226/gamegoo .
# DockerHub Login (3)
- name: docker login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PW }}
# Docker Hub push (4)
- name: docker Hub push
run: docker push rimi3226/gamegoo