Skip to content

Commit

Permalink
use gradle action instead of doing it manually
Browse files Browse the repository at this point in the history
Mari023 committed Jun 28, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent f5d442f commit 16b29ff
Showing 2 changed files with 20 additions and 47 deletions.
54 changes: 14 additions & 40 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: build neoforge
on:
push:
@@ -14,33 +11,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: adopt
java-version: 21
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Use gradle cache for faster builds
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
- name: Cleanup Gradle Cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
- name: Setup Gradle Wrapper Cache
uses: actions/cache@v4
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Build with Gradle
run: ./gradlew build
run: gradle assemble
env:
HASH: $(git rev-parse --short "$GITHUB_SHA")

- name: Upload a Build Artifact
uses: actions/upload-artifact@v4
with:
@@ -50,28 +35,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: adopt
java-version: 21
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Use gradle cache for faster builds
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
- name: Cleanup Gradle Cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
- name: Setup Gradle Wrapper Cache
uses: actions/cache@v4

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
cache-read-only: true

- name: format
run: ./gradlew spotlessCheck
run: gradle spotlessCheck
13 changes: 6 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: publish to modrinth and curseforge

on:
@@ -19,11 +16,13 @@ jobs:
distribution: adopt
java-version: 21

- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: true

- name: Build with Gradle
run: ./gradlew build
run: gradle build
env:
TAG: ${{ github.event.release.tag_name }}

@@ -34,7 +33,7 @@ jobs:
name: neoforge
retention-days: 2

publish_neoforge:
publish:
runs-on: ubuntu-latest
needs: build
steps:

0 comments on commit 16b29ff

Please sign in to comment.