From 826e014117932e9e31d6cc0e333755d909aef19d Mon Sep 17 00:00:00 2001 From: James Martin Date: Tue, 17 Nov 2020 17:36:55 -0800 Subject: [PATCH] Add GitHub workflow to build with Gradle. --- .github/workflows/ci.yml | 28 ++++++++++++++++++++++++++++ build.gradle | 4 ++-- 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..876404b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,28 @@ +name: CI +on: [push] +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Set up JDK 14 + uses: actions/setup-java@v1 + with: + java-version: 14 + + - name: Cache Gradle packages + uses: actions/cache@v2 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} + restore-keys: ${{ runner.os }}-gradle + + - name: Build with Gradle + run: ./gradlew build + env: + # Necessary to fetch Towny dependency from GitHub packages. + GITHUB_ACTOR: ${{ github.actor }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/build.gradle b/build.gradle index 52ced7a..b436424 100644 --- a/build.gradle +++ b/build.gradle @@ -26,8 +26,8 @@ repositories { name = "Towny" url = "https://maven.pkg.github.com/TownyAdvanced/Towny" credentials { - username = project.findProperty("gpr.user") ?: System.getenv("USERNAME") - password = project.findProperty("gpr.key") ?: System.getenv("TOKEN") + username = project.findProperty("gpr.user") ?: System.getenv("GITHUB_ACTOR") + password = project.findProperty("gpr.key") ?: System.getenv("GITHUB_TOKEN") } } }