
Github Actions를 이용한 배포 자동화를 학습하는 중 Gradle 빌드가 기본적으로 구성되어있는 "Java with Gradle" workflow를 생성했다. 기본적으로 아래와 같이 gradle.yml 파일을 생성해준다.
name: Java CI with Gradle
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Build with Gradle
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
with:
arguments: build
위 gradle.yml 파일을 수정하지 않고 그대로 Start commit 을 진행하면 Actions 탭에서 workflow의 진행 상황을 확인할 수 있다.


실패한 경우 빨간 동그라미의 X 아이콘이 뜨며 상세 내역을 확인할 수 있다. Error: Gradle script is not executable. Gradle을 실행할 수 없다고 한다. 이에 대한 해결책으로 chmod 명령어를 통해 gradle에 실행 권한을 부여하면 된다.
- name: Run chmod to make gradlew executable
run: chmod +x ./gradlew
gradle 실행 권한을 부여하는 작업이다. 위 코드를 gradle.yml 파일에 추가적으로 작성한 후 create commit을 진행한다.

이제 Actions 탭으로 돌아가 확인해보면 정상적으로 전 workflow 작업이 완료된 것을 확인할 수 있다.
참고) https://spacetech.dk/error-gradle-script-home-runner-work-gradlew-is-not-executable.html
'개발 > Git' 카테고리의 다른 글
[Github] Pull Request 템플릿 만들기 (0) | 2024.03.19 |
---|---|
[Git] 이미 리포지토리에 업로드 된 커밋 삭제하기 (0) | 2023.08.15 |
[Github] 깃허브 리포지토리 필수 파일 - README.md / .gitignore / LICENCE (0) | 2022.12.17 |
[Github] 깃허브 SSH key 등록하기 - git@github.com:Permission denied (publickey) (0) | 2022.12.02 |
[Github] 깃허브 README.md 리드미 꾸미기 정리 (0) | 2022.10.07 |