๐ท[CD]:GitHub Actions, Docker ๋ฐฐํฌ ๊ด๋ จ #27
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
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 |