Skip to content

Commit

Permalink
Update main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
tls3254 authored Apr 7, 2024
1 parent 44f2bc1 commit e49f0ec
Showing 1 changed file with 55 additions and 16 deletions.
71 changes: 55 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,62 @@
name: CI

name: CI/CD # 1 깃허브 액션 이름 변경
on:
push:
branches:
- main
branches: [ main ]
pull_request:
branches: [ main ]

env:
RESOURCE_PATH: ./src/main/resources/application.yml, # application.yml 설정 파일

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up JDK 11
uses: actions/setup-java@v2
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17
- run: touch ./src/main/resources/application.yml # 해당 경로에 파일 생성
- run: echo "${{ secrets.APPLICATION }}" > ./src/main/resources/application.yml # "${{ secrets.APPLICATION }}" 이 부분을 기존 yml파일의 내용을 삭제하고 추가
- run: cat ./src/main/resources/application.yml # yml파일 내용 확인

# gradle 버전 설정
- name: Setup Gradle Wrapper
run: gradle wrapper --gradle-version 8.5
shell: bash

- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
shell: bash

# [2]
# - name: Build with Gradle
# run: ./gradlew clean build
# shell: bash

# 권한 부여
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
env:
MY_SECRET_PROPERTY: ${{ secrets.PROPERTIES }}
run: ./gradlew build --info
run: ./gradlew clean build
# run 키워드는 실행할 명령어를 입력
# ./gradlew clean build에는 그레들을 사용해 프로젝트를 빌드 이전 상태로 돌리고 다시 빌드하는 명령어를 실행

# 2 현재시간 가져오기
- name: Get current time
uses: josStorer/[email protected]
id: current-time
with:
format: "YYYY-MM-DDTHH-mm-ss"
utcOffset: "+09:00"

# 3 배포용 패키지 경로 저장
- name: Set artifact
run: echo "artifact=$(ls ./build/libs)" >> $GITHUB_ENV
# $GITHUB_ ENV를 사용해 깃허브 워크플로 전체적으로 사용할 수 있는 환경 변수를 설정할 수 있습니다.
shell: bash

- name: Show artifact
run: echo "Artifact is ${{ env.artifact }}"
shell: bash

0 comments on commit e49f0ec

Please sign in to comment.