Use libraries from Paper repo (#82) #419
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: [ "**" ] | |
tags-ignore: [ "**" ] | |
pull_request: | |
release: | |
types: [ published ] | |
jobs: | |
build: | |
# Only run on PRs if the source branch is on someone else's repo | |
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: "checkout git repository" | |
uses: actions/checkout@v4 | |
- name: "setup jdk" | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 21 | |
- name: "setup gradle" | |
uses: gradle/actions/setup-gradle@v4 | |
# gradle-build-action doesn't support caching files in the project dir | |
- name: "cache project local caches" | |
uses: actions/cache@v4 | |
with: | |
path: | | |
.gradle/loom-cache | |
key: ${{ runner.os }}-project-local-gradle-caches-${{ hashFiles('**/libs.versions.toml', '**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-project-local-gradle-caches- | |
- name: "execute gradle build" | |
run: ./gradlew build | |
- name: Determine Snapshot Status | |
run: | | |
if [ "$(./gradlew properties | awk '/^version:/ { print $2; }' | grep '\-SNAPSHOT')" ]; then | |
echo "STATUS=snapshot" >> $GITHUB_ENV | |
else | |
echo "STATUS=release" >> $GITHUB_ENV | |
fi | |
- name: Publish (Pre-)Release to Modrinth & CurseForge | |
if: "${{ env.STATUS == 'release' && github.event_name == 'release' }}" | |
run: ./gradlew :moonrise-fabric:publishMods :moonrise-neoforge:publishMods | |
env: | |
MODRINTH_TOKEN: "${{ secrets.MODRINTH_TOKEN }}" | |
CURSEFORGE_TOKEN: "${{ secrets.CURSEFORGE_TOKEN }}" | |
RELEASE_NOTES: "${{ github.event.release.body }}" | |
- name: "upload artifacts" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts | |
path: "**/build/libs/*.jar" |