From eaad9214a4926240609c9e0f15a9c543b774b187 Mon Sep 17 00:00:00 2001 From: Boxadactle Date: Sat, 17 Aug 2024 19:55:29 -0700 Subject: [PATCH] compile with correct version --- .github/workflows/build.yml | 47 ++++++------ .github/workflows/compile.yml | 26 +++++++ .github/workflows/publish.yml | 72 ++++++++++--------- CHANGELOG.md | 2 + build.gradle | 26 +++++++ .../CoordinatesDisplay.java | 2 +- fabric/build.gradle | 2 +- gradle.properties | 6 +- 8 files changed, 122 insertions(+), 61 deletions(-) create mode 100644 .github/workflows/compile.yml create mode 100644 CHANGELOG.md diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a42eb23..481a9bd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,27 +14,30 @@ permissions: jobs: build: - runs-on: windows-latest + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Set up JDK 21 - uses: actions/setup-java@v3 - with: - java-version: '21' - distribution: 'temurin' - - - name: Build with Gradle - run: ./gradlew build - - - name: Upload fabric - uses: actions/upload-artifact@v3 - with: - name: fabric-build - path: fabric/build/libs - - - name: Upload forge - uses: actions/upload-artifact@v3 - with: - name: forge-build - path: forge/build/libs + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + + - name: Set up gradlew + run: chmod +x ./gradlew + + - name: Build with Gradle + run: ./gradlew build + + - name: Upload fabric + uses: actions/upload-artifact@v4 + with: + name: fabric-build + path: fabric/build/libs + + - name: Upload forge + uses: actions/upload-artifact@v4 + with: + name: forge-build + path: forge/build/libs \ No newline at end of file diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml new file mode 100644 index 0000000..f419928 --- /dev/null +++ b/.github/workflows/compile.yml @@ -0,0 +1,26 @@ +name: Compile +on: [ push, pull_request ] + +permissions: + contents: read + +jobs: + compile: + + runs-on: ubuntu-latest + + steps: + + - uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + + - name: Set up gradlew + run: chmod +x ./gradlew + + - name: Compile java + run: ./gradlew compileJava \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 60f9bfd..9999291 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -6,45 +6,49 @@ # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle name: Publish -on: - push: - branches: [ "latest" ] - pull_request: - branches: [ "latest" ] +on: [ workflow_dispatch ] permissions: contents: read jobs: - build: + publish: - runs-on: windows-latest + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Set up JDK 21 - uses: actions/setup-java@v3 - with: - java-version: '21' - distribution: 'temurin' - - - name: Build with Gradle - run: ./gradlew build - - - name: Upload fabric - uses: actions/upload-artifact@v3 - with: - name: fabric-build - path: fabric/build/libs - - - name: Upload forge - uses: actions/upload-artifact@v3 - with: - name: forge-build - path: forge/build/libs - - - name: Publish - run: ./gradlew publishUnified - env: - CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} - MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + + - name: Set up gradlew + run: chmod +x ./gradlew + + - name: Build with Gradle + run: ./gradlew build + + - name: Upload fabric + uses: actions/upload-artifact@v4 + with: + name: fabric-build + path: fabric/build/libs + + - name: Upload neoforge + uses: actions/upload-artifact@v4 + with: + name: neoforge-build + path: neoforge/build/libs + + - name: Publish + run: ./gradlew publishUnified + env: + CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} + MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} + + - name: Create GitHub release + run: ./gradlew githubRelease + env: + GITHUB_TOKEN: ${{ secrets.REPOSITORY_TOKEN }} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..6226948 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,2 @@ +## Changes +- Now compiled with the correct java version \ No newline at end of file diff --git a/build.gradle b/build.gradle index 2a43cdc..2c9cb95 100644 --- a/build.gradle +++ b/build.gradle @@ -3,6 +3,7 @@ plugins { id 'architectury-plugin' version '3.4-SNAPSHOT' id 'com.github.johnrengelman.shadow' version '8.1.1' apply false id "me.shedaniel.unified-publishing" version "0.1.+" + id "com.github.breadmoirai.github-release" version "2.5.2" } architectury { @@ -66,3 +67,28 @@ subprojects { } } } + + +githubRelease { + owner = "Boxadactle" + repo = "coordinates-display" + tagName = "$project.version" + targetCommitish = "latest" + releaseName = "Coordinates Display $project.version" + generateReleaseNotes = true + body = """Coordinates Display $project.version for Minecraft $project.minecraft_version + +${new File(rootProject.rootDir, project.changelog_file).text} +""" + authorization = "Token ${System.getenv("GITHUB_TOKEN")}" + + var files = [] + for (String platform : project.enabled_platforms.split(',')) { + files += fileTree("$platform/build/libs") { + include "*$project.version*" + } + } + releaseAssets = files + +// dryRun = true +} \ No newline at end of file diff --git a/common/src/main/java/dev/boxadactle/coordinatesdisplay/CoordinatesDisplay.java b/common/src/main/java/dev/boxadactle/coordinatesdisplay/CoordinatesDisplay.java index 8489e34..ac516c8 100644 --- a/common/src/main/java/dev/boxadactle/coordinatesdisplay/CoordinatesDisplay.java +++ b/common/src/main/java/dev/boxadactle/coordinatesdisplay/CoordinatesDisplay.java @@ -21,7 +21,7 @@ public class CoordinatesDisplay { public static final String MOD_ID = "coordinatesdisplay"; - public static final String VERSION = "2.4.0"; + public static final String VERSION = "2.4.1"; public static final String VERSION_STRING = MOD_NAME + " v" + VERSION; diff --git a/fabric/build.gradle b/fabric/build.gradle index 6c233df..b48cc5c 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -60,7 +60,7 @@ unifiedPublishing { project { displayName = "[Fabric ${rootProject.minecraft_version}] v$rootProject.mod_version" version = "$rootProject.version-fabric" - changelog = "A changelog can be found here: ${rootProject.releases_page}tag/$rootProject.mod_version" + changelog = "A changelog can be found here: https://github.com/Boxadactle/coordinates-display/releases/tag/$rootProject.mod_version" releaseType = rootProject.release_type gameVersions = Arrays.asList(rootProject.game_versions.split(",")) gameLoaders = [ "fabric", "quilt" ] diff --git a/gradle.properties b/gradle.properties index ca087f8..cc05765 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx2G org.gradle.parallel=true # Mod properties -mod_version = 2.4.0 +mod_version = 2.4.1 maven_group = dev.boxadactle archives_name = CoordinatesDisplay enabled_platforms = fabric @@ -17,11 +17,11 @@ fabric_api_version = 0.28.5+1.15 forge_version = 31.2.57 modmenu_version = 1.10.4+build.1 -boxlib_version = 3.0.0 +boxlib_version = 3.0.2 # publishing game_versions = 1.15.2 project_id_curseforge = 646464 project_id_modrinth = 3mW8PdUo release_type = release -releases_page = https://github.com/Boxadactle/coordinates-display/releases/ \ No newline at end of file +changelog_file = CHANGELOG.md \ No newline at end of file