[UPDATE] : UPDATED Git Workflow to create no-auth-based Docker Image #5
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: Spring Boot CI with Gradle | |
on: | |
push: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
## create application-private.properties | |
- name: make application-private.properties | |
run: | | |
## create application-private.properties | |
cd ./src/main/resources | |
# application-private.properties 파일 생성 | |
touch ./application-private.properties | |
# GitHub-Actions 에서 설정한 값을 application-private.properties 파일에 쓰기 | |
echo "${{ secrets.SPRING_BE_APPLICATION_PRIVATE }}" >> ./application-private.properties | |
shell: bash | |
# gradle build | |
- name: Build with Gradle | |
run: | | |
chmod +x ./gradlew | |
./gradlew bootJar | |
shell: bash | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.ORG_JUDEMIN_DOCKERHUB_USERNAME }} | |
password: ${{ secrets.ORG_JUDEMIN_DOCKERHUB_PASSWORD }} | |
- name: Docker build and push | |
id: docker_build | |
uses: docker/build-push-action@v2 | |
with: | |
# Dockerfile이 위치한 디렉토리를 지정 | |
context: . | |
push: true | |
tags: judemin/wwwm-spring-be:no-auth-based | |
# GitHub Action Cache | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |