From 87fdecff75d3b75ebe7967ec78971d75688e7dd4 Mon Sep 17 00:00:00 2001 From: Frank van der Heijden Date: Fri, 12 Jan 2024 14:54:57 +0100 Subject: [PATCH] v6.17.2 --- .github/workflows/gradle.yml | 35 +++++++++++++++++++++++++++-------- build.gradle.kts | 18 +++++++++++++++++- 2 files changed, 44 insertions(+), 9 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 83206f78..402ff076 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -5,14 +5,14 @@ on: pull_request: branches: [ master ] jobs: - build: + publish: runs-on: ubuntu-latest strategy: matrix: java-version: [ 17 ] fail-fast: true steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup JDK ${{ matrix.java-version }} uses: actions/setup-java@v3 with: @@ -23,18 +23,37 @@ jobs: - uses: actions/cache@v3 with: path: '**/.gradle' - key: ${{ runner.os }}-gradle-${{ secrets.CACHE_VERSION }}-${{ hashFiles('**/VersionConstants.kt', '**/build.gradle.kts', '**/gradle-wrapper.properties') }} + key: ${{ runner.os }}-gradle-${{ vars.CACHE_VERSION }}-${{ hashFiles('**/VersionConstants.kt', '**/build.gradle.kts', '**/gradle-wrapper.properties') }} - name: Build - run: ./gradlew clean build --stacktrace - - name: Upload artififacts - uses: actions/upload-artifact@v3 + id: build + run: | + ./gradlew clean build --stacktrace + echo "is-release=$(./gradlew -q printIsRelease)" >> "$GITHUB_OUTPUT" + echo "version=$(./gradlew -q printVersion)" >> "$GITHUB_OUTPUT" + - name: Upload artifacts + uses: actions/upload-artifact@v4 with: name: Insights path: jars/*.jar - retention-days: 90 - - name: Publish + - name: Publish to Maven Repository if: ${{ github.event_name == 'push' }} env: FVDH_USERNAME: ${{ secrets.FVDH_USERNAME }} FVDH_TOKEN: ${{ secrets.FVDH_TOKEN }} run: ./gradlew publish --stacktrace + - uses: Kir-Antipov/mc-publish@v3.3 + if: ${{ github.event_name == 'push' && steps.build.outputs.is-release == 'true' }} + with: + name: ${{ format(Insights '{0}', steps.build.outputs.version) }} + modrinth-id: V27CDDh1 + modrinth-token: ${{ secrets.MODRINTH_TOKEN }} + github-token: ${{ secrets.GITHUB_TOKEN }} + files: | + jars/*.jar + loaders: | + paper + purpur + game-versions: | + >=1.19.4 <=1.20.4 + game-version-filter: releases + java: 17 diff --git a/build.gradle.kts b/build.gradle.kts index ffdc3ae1..5300fa0f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -12,7 +12,7 @@ plugins { val name = "Insights" group = "dev.frankheijden.insights" val dependencyDir = "$group.dependencies" -version = "6.17.1" +version = "6.17.2" subprojects { apply(plugin = "java") @@ -167,6 +167,22 @@ val artifact: PublishArtifact = artifacts.add("archives", artifactFile) { builtBy("shadowJar") } +fun Project.isRelease(): Boolean { + return version.toString().toVersion().preRelease == null +} + +task("printIsRelease") { + doLast { + println(isRelease()) + } +} + +task("printVersion") { + doLast { + println(version.toString()) + } +} + publishing { repositories { maven {