Skip to content

Commit

Permalink
add actions
Browse files Browse the repository at this point in the history
Co-authored-by: TheEpicBlock <[email protected]>
(new setup gradle action replaces old caching method)
  • Loading branch information
sisby-folk committed Jul 28, 2024
1 parent a1f7293 commit 305a648
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 19 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ indent_size = 4
indent_style = tab
tab_width = 4

[*.yml]
indent_size = 2
indent_style = space

[*.java]
ij_java_block_brace_style = end_of_line
ij_java_lambda_brace_style = end_of_line
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup jdk
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
validate-wrappers: true

- name: Build with Gradle
run: ./gradlew build
41 changes: 22 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,44 @@
name: release
name: Release

on:
release:
types:
- published

jobs:
github-release:
upload:
runs-on: ubuntu-latest
steps:
- name: Cache
uses: actions/cache@v2
with:
path: |
~/.gradle/loom-cache
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
gradle-
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup JDK 21
uses: actions/setup-java@v1
- name: Setup jdk
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'

- name: Ensure gradlew is executable
run: chmod +x gradlew
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
validate-wrappers: true

- name: Build mod
- name: Build with Gradle
run: ./gradlew build

- name: Upload GitHub release
uses: AButler/[email protected]
with:
files: 'build/libs/*.jar;!build/libs/*-sources.jar;!build/libs/*-dev.jar'
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to Modrinth
run: ./gradlew modrinth
env:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_MASCOT_TOKEN }}
CHANGELOG: ${{ github.event.release.body }}

- name: Sync README
run: ./gradlew modrinthSyncBody
env:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_MASCOT_TOKEN }}
13 changes: 13 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
plugins {
id "maven-publish"
alias libs.plugins.loom
alias libs.plugins.minotaur
}

version = "$project.baseVersion+$project.branch"
Expand Down Expand Up @@ -70,3 +71,15 @@ publishing {
}
}
}

modrinth {
token = System.getenv("MODRINTH_TOKEN")
projectId = "scattered-shards"
dependencies {
required.version "fabric-api", libs.versions.fapi.get()
embedded.version "fabric-permissions-api", libs.versions.fpapi.get()
}
changelog = System.getenv("CHANGELOG")
syncBodyFrom = "<!--DO NOT EDIT MANUALLY: synced from gh readme-->\n" + rootProject.file("README.md").text
uploadFile = remapJar
}
2 changes: 2 additions & 0 deletions libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[versions]
loom = "1.7.+"
minotaur = "2.+"

mc = "1.21"
fl = "0.15.11"
Expand All @@ -11,6 +12,7 @@ libgui = "11.0.0+1.21"

[plugins]
loom = { id = "fabric-loom", version.ref = "loom" }
minotaur = { id = "com.modrinth.minotaur", version.ref = "minotaur" }

[libraries]
mc = { group = "mojang", name = "minecraft", version.ref = "mc" }
Expand Down

0 comments on commit 305a648

Please sign in to comment.