From 9d70c2131c91638aec6c160d19e3ae98f71059f4 Mon Sep 17 00:00:00 2001 From: js6pak Date: Fri, 8 Apr 2022 19:55:52 +0200 Subject: [PATCH] Add publishing to CI --- .github/workflows/build.yml | 21 +++++++++++++++++++++ CHANGELOG.md | 2 ++ README.md | 2 +- build.gradle | 18 +++++++++++++++++- 4 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 CHANGELOG.md diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5452a0e..3611c00 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,6 +13,15 @@ jobs: uses: actions/setup-java@v1 with: java-version: 17 + - uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/loom-cache + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- - name: build run: ./gradlew build - name: capture build artifacts @@ -20,3 +29,15 @@ jobs: with: name: Artifacts path: build/libs/ + - name: release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + draft: false + body_path: CHANGELOG.md + files: build/libs/*.jar + - name: modrinth + if: startsWith(github.ref, 'refs/tags/') + env: + MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} + run: ./gradlew modrinth diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..5bfb45e --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,2 @@ +- Rewrite +- Port to [babric](https://babric.github.io/) \ No newline at end of file diff --git a/README.md b/README.md index 6be9ac0..a0039e6 100644 --- a/README.md +++ b/README.md @@ -32,5 +32,5 @@ Allows the server to verify that the connecting player is logged in
Inventory tweaks -
\ No newline at end of file diff --git a/build.gradle b/build.gradle index 508a9fd..d66402b 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,7 @@ plugins { id 'babric-loom' version '0.12-SNAPSHOT' id "maven-publish" + id("com.modrinth.minotaur") version "2.+" id "com.diffplug.spotless" version "6.2.2" } @@ -11,7 +12,12 @@ group = project.maven_group def ENV = System.getenv() if (ENV.GITHUB_RUN_NUMBER) { - version = project.mod_version + '-ci.' + ENV.GITHUB_RUN_NUMBER + if (ENV.GITHUB_REF && ENV.GITHUB_REF.startsWith("refs/tags/")) { + version = project.mod_version + spotless.enforceCheck = false + } else { + version = project.mod_version + '-ci.' + ENV.GITHUB_RUN_NUMBER + } } else { version = project.mod_version + '+local' } @@ -68,3 +74,13 @@ spotless { licenseHeaderFile(rootProject.file("HEADER")) } } + +modrinth { + projectId = "8sdj2JBj" + uploadFile = remapJar + gameVersions = [project.minecraft_version] + loaders = ["fabric"] + changelog = rootProject.file("CHANGELOG.md").text + syncBodyFrom = rootProject.file("README.md").text +} +tasks.modrinth.dependsOn(tasks.modrinthSyncBody) \ No newline at end of file