Why when I use github actions CI for a gradle project I face "./gradlew: Permission denied" error?
I found the answer!
I just had to change the gradlew file permission on the git repository to make it executable using this command:
git update-index --chmod=+x gradlew
git commit -m "Make gradlew executable"
it was simple but killed my time!
To solve this issue, you might need to add chmod
action before gradle
one. Like this one:
- name: Change wrapper permissions
run: chmod +x ./gradlew
So overall workflow file may look like this:
name: Java CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Change wrapper permissions
run: chmod +x ./gradlew
- name: Build with Gradle
run: ./gradlew build