From 6377cfe326a5c0f7aef3794200aa96f0c0494ec2 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Mon, 10 Jun 2024 17:25:05 -0400 Subject: [PATCH] better cache --- .github/workflows/build.yml | 19 ++++++++++++++----- .github/workflows/release.yml | 35 ++++++++++++++++++++--------------- 2 files changed, 34 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 45cf5ecef..f2d3f6384 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,12 +9,21 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 - - name: Setup JDK 17 - uses: actions/setup-java@v4 + - name: Setup Java + run: echo "JAVA_HOME=$JAVA_HOME_17_X64" >> "$GITHUB_ENV" + + - name: Loom Cache + uses: actions/cache@v4 + with: + path: "**/.gradle/loom-cache" + key: "${{ runner.os }}-gradle-${{ hashFiles('**/libs.versions.*', '**/*.gradle*', '**/gradle-wrapper.properties') }}" + restore-keys: "${{ runner.os }}-gradle-" + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 with: - java-version: '17' - distribution: temurin - cache: gradle + gradle-home-cache-cleanup: true + cache-read-only: ${{ !endsWith(github.ref, '/dev') }} - name: Validate Gradle Wrapper Integrity uses: gradle/wrapper-validation-action@v2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 70870ce33..8d70a2819 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,30 +12,35 @@ on: - forge jobs: - release: + build: runs-on: ubuntu-latest - env: - RELEASE_BUILD: true - MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} - CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} - MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }} - steps: - name: Checkout Repository uses: actions/checkout@v4 - - name: Setup JDK 17 - uses: actions/setup-java@v4 + - name: Setup Java + run: echo "JAVA_HOME=$JAVA_HOME_17_X64" >> "$GITHUB_ENV" + + - name: Loom Cache + uses: actions/cache@v4 with: - java-version: '17' - distribution: temurin - cache: gradle + path: "**/.gradle/loom-cache" + key: "${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}" + restore-keys: "${{ runner.os }}-gradle-" + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + with: + gradle-home-cache-cleanup: true + cache-read-only: true - name: Validate Gradle Wrapper Integrity uses: gradle/wrapper-validation-action@v2 - - name: Set Platform environment variable - run: echo "PLATFORM=${{ inputs.platform }}" >> $GITHUB_ENV - - name: Build & Publish + env: + RELEASE_BUILD: true + MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} + CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} + MAVEN_TOKEN: ${{ secrets.MAVEN_TOKEN }} run: ./gradlew railwaysPublish \ No newline at end of file