diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index c3ec2e996a..e54c90f0a6 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -1,39 +1,39 @@ -name: build-release +# This workflow will build a Java project with Brachyra +# For more information see: docs/development/brachyura.md -on: - release: - types: - - published +name: Java CI with Gradle + +on: [ push, pull_request ] jobs: build: runs-on: ubuntu-latest + steps: - - name: Checkout sources - uses: actions/checkout@v2 - - name: Set up JDK 17 - uses: actions/setup-java@v2 + - uses: actions/checkout@v2 + + - uses: actions/setup-java@v4 with: - distribution: 'temurin' - java-version: 17 - - name: Cache Brachyura directory - uses: actions/cache@v2 + distribution: temurin + java-version: 21 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 with: - path: | - .brachyura - ~/.brachyura - key: ${{ runner.os }}-brachyura-${{ hashFiles('**/Buildscript.java') }} - restore-keys: ${{ runner.os }}-brachyura + cache-read-only: false - - name: Build with Brachyura - run: java -Diris.release=true -jar brachyura-bootstrap-0.jar build + - name: Run build with Gradle Wrapper + run: ./gradlew build -Dbuild.release=true - name: Upload artifacts to Modrinth and GitHub uses: Kir-Antipov/mc-publish@v3.3 with: modrinth-id: YL57xq9U modrinth-token: ${{ secrets.MODRINTH_TOKEN }} - modrinth-featured: false + modrinth-featured: true + + curseforge-id: 455508 + curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/build.gradle.kts b/build.gradle.kts index 70dd52ea40..851c60f657 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -216,7 +216,7 @@ tasks.withType { fun createVersionString(): String { val builder = StringBuilder() - val isReleaseBuild = project.hasProperty("build.release") + val isReleaseBuild = System.getProperty("build.release") != null val buildId = System.getenv("GITHUB_RUN_NUMBER") if (isReleaseBuild) { @@ -226,13 +226,13 @@ fun createVersionString(): String { builder.append("-snapshot") } - val open = Grgit.open { - dir = rootDir - } - builder.append("+mc").append(Constants.MINECRAFT_VERSION) if (!isReleaseBuild) { + val open = Grgit.open { + dir = rootDir + } + if (buildId != null) { builder.append("-build.${buildId}") } else if (open == null) {