diff --git a/.editorconfig b/.editorconfig index 80aa62f..d8d3966 100644 --- a/.editorconfig +++ b/.editorconfig @@ -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 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..c4a6cdc --- /dev/null +++ b/.github/workflows/build.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 37aecac..229d77f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: release +name: Release on: release: @@ -6,32 +6,24 @@ on: - 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 @@ -39,3 +31,14 @@ jobs: 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 }} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 7219af0..e82a8cf 100644 --- a/build.gradle +++ b/build.gradle @@ -3,6 +3,7 @@ plugins { id "maven-publish" alias libs.plugins.loom + alias libs.plugins.minotaur } version = "$project.baseVersion+$project.branch" @@ -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 = "\n" + rootProject.file("README.md").text + uploadFile = remapJar +} diff --git a/libs.versions.toml b/libs.versions.toml index 783e854..b960592 100644 --- a/libs.versions.toml +++ b/libs.versions.toml @@ -1,5 +1,6 @@ [versions] loom = "1.7.+" +minotaur = "2.+" mc = "1.21" fl = "0.15.11" @@ -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" }