diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4e62308a7..b787cd4ee 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,7 @@ name: 'Release' on: release: - types: [created] + types: [published] jobs: build: @@ -36,13 +36,28 @@ jobs: run: ./gradlew runData --no-daemon - name: Validate assets run: test -d ./src/generated - - name: Build, sign, and publish with Gradle + - name: Build with Gradle env: KEY_STORE_PASS: ${{ secrets.KEY_STORE_PASS }} KEY_STORE_ALIAS: ${{ secrets.KEY_STORE_ALIAS }} KEY_STORE_KEY_PASS: ${{ secrets.KEY_STORE_KEY_PASS }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: ./gradlew build publish --no-daemon + run: ./gradlew build --no-daemon + - name: Upload to curseforge + env: + KEY_STORE_PASS: ${{ secrets.KEY_STORE_PASS }} + KEY_STORE_ALIAS: ${{ secrets.KEY_STORE_ALIAS }} + KEY_STORE_KEY_PASS: ${{ secrets.KEY_STORE_KEY_PASS }} + CHANGELOG: ${{ github.event.release.body }} + CURSEFORGE: ${{ secrets.CURSEFORGE }} + run: ./gradlew curseforge --no-daemon + - name: Publish to github packages + env: + KEY_STORE_PASS: ${{ secrets.KEY_STORE_PASS }} + KEY_STORE_ALIAS: ${{ secrets.KEY_STORE_ALIAS }} + KEY_STORE_KEY_PASS: ${{ secrets.KEY_STORE_KEY_PASS }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: ./gradlew publish --no-daemon - name: Prepare artifact metadata id: prepare_artifact_metadata run: | diff --git a/build.gradle b/build.gradle index 36ac4474c..159a8772c 100644 --- a/build.gradle +++ b/build.gradle @@ -30,6 +30,7 @@ buildscript { plugins { id "maven-publish" id "com.diffplug.gradle.spotless" version "4.3.0" + id "com.matthewprenger.cursegradle" version "1.4.0" id "org.sonarqube" version "2.8" id "jacoco" } @@ -165,6 +166,7 @@ task signJar(type: net.minecraftforge.gradle.common.task.SignJar, dependsOn: 're } apply from: 'gradle/scripts/artifacts.gradle' +apply from: 'gradle/scripts/curseforge.gradle' publishing { publications { diff --git a/gradle.properties b/gradle.properties index 0edae7d09..37d06fd65 100644 --- a/gradle.properties +++ b/gradle.properties @@ -26,6 +26,7 @@ ctm_version=MC1.15.2-1.1.0.9 ######################################################### website_version=1.15.2 curse_versions=1.15.2 +curseforge_project=223794 ######################################################### # Gradle # diff --git a/gradle/scripts/curseforge.gradle b/gradle/scripts/curseforge.gradle new file mode 100644 index 000000000..a925a4506 --- /dev/null +++ b/gradle/scripts/curseforge.gradle @@ -0,0 +1,39 @@ +/* + * This file is part of Applied Energistics 2. + * Copyright (c) 2020, TeamAppliedEnergistics, All rights reserved. + * + * Applied Energistics 2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Applied Energistics 2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + *g GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Applied Energistics 2. If not, see . + */ + +def isAlpha = project.version.contains("alpha") +def isBeta = project.version.contains("beta") + +def cfReleaseType = "release" +if (isAlpha) { + cfReleaseType = "alpha" +} else if (isBeta) { + cfReleaseType = "beta" +} + +if (System.getenv("CURSEFORGE")) { + curseforge { + apiKey = System.getenv("CURSEFORGE") + project { + id = project.curseforge_project + changelogType = "markdown" + changelog = System.getenv("CHANGELOG") ?: "Please visit our [releases](https://github.com/AppliedEnergistics/Applied-Energistics-2/releases) for a changelog" + releaseType = cfReleaseType + } + } +} \ No newline at end of file