Skip to content

Update gradle.yml

Update gradle.yml #5

Workflow file for this run

# 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 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
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
# Java 17 설정
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
# application-secret.yml 생성
- name: make application-secret.yml
run: |
touch ./src/main/resources/application-secret.yml
echo "${{ secrets.APPLICATION_SECRET }}" > ./src/main/resources/application-secret.yml
shell: bash
# Spring boot Application build
- name: Build with Gradle 8.5
run: gradle build
# Docker Image build
- name : docker image build
run: docker build --platform linux/amd64 -t ${{ secrets.DOCKERHUB_USERNAME }}/github-actions-demo .
# DockerHub login
- name: docker login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
# DockerHub Image push
- name: dockerhub push
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/github-actions-demo