From 548c77252fd6b78055fb3962c00213ed12f39d74 Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Sun, 12 Dec 2021 23:28:43 +0100 Subject: [PATCH] Add CurseForge plugin --- .github/workflows/release.yml | 48 ++++++++++++++++++++--------------- build.gradle | 20 +++++++++++++++ 2 files changed, 47 insertions(+), 21 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d691fb565..5162e858b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,7 +7,7 @@ jobs: build: runs-on: ubuntu-latest steps: - - name: Get tag name + - name: Get tag name uses: olegtarasov/get-tag@v2.1 id: tagName - name: Validate semver @@ -47,26 +47,32 @@ jobs: id: changelog_reader uses: mindsers/changelog-reader-action@v2 with: - version: 'Unreleased' - path: ./CHANGELOG.md - - name: Release on GitHub - uses: softprops/action-gh-release@v1 - id: ghRelease - with: - body: ${{ steps.changelog_reader.outputs.changes }} - name: ${{ steps.tagName.outputs.tag }} - files: | - build/libs/*.jar - # This is necessary because the Discord action doesn't support GH actions variable expansion? - - name: Set release URL - run: | - echo "RELEASE_URL=${{ steps.ghRelease.outputs.url }}" >> $GITHUB_ENV - - name: Notify Discord - uses: Ilshidur/action-discord@0.3.2 - with: - args: 'Refined Storage {{ GIT_TAG_NAME }} has been released! {{ RELEASE_URL }}' - env: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + version: 'Unreleased' + path: ./CHANGELOG.md + - name: Release on GitHub + uses: softprops/action-gh-release@v1 + id: ghRelease + with: + body: ${{ steps.changelog_reader.outputs.changes }} + name: ${{ steps.tagName.outputs.tag }} + files: | + build/libs/*.jar + - name: Release on CurseForge + run: ./gradlew curseforge + env: + RELEASE: ${{ steps.tagName.outputs.tag }} + CHANGELOG: ${{ steps.changelog_reader.outputs.changes }} + CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} + # This is necessary because the Discord action doesn't support GH actions variable expansion? + - name: Set release URL + run: | + echo "RELEASE_URL=${{ steps.ghRelease.outputs.url }}" >> $GITHUB_ENV + - name: Notify Discord + uses: Ilshidur/action-discord@0.3.2 + with: + args: 'Refined Storage {{ GIT_TAG_NAME }} has been released! {{ RELEASE_URL }}' + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} - name: Notify Twitter uses: ethomson/send-tweet-action@v1 with: diff --git a/build.gradle b/build.gradle index 60239e941..b0ca8a4fa 100755 --- a/build.gradle +++ b/build.gradle @@ -8,6 +8,10 @@ buildscript { } } +plugins { + id 'com.matthewprenger.cursegradle' version '1.4.0' +} + repositories { maven { url = "https://dvs1.progwml6.com/files/maven/" @@ -125,6 +129,22 @@ jar { } } +if (System.getenv("CURSEFORGE_TOKEN") != null) { + curseforge { + apiKey = System.getenv("CURSEFORGE_TOKEN") + project { + id = '243076' + changelog = System.getenv("CHANGELOG") + changelogType = 'markdown' + releaseType = project.version.toString().contains('beta') ? 'beta' : (project.version.toString().contains('alpha') ? 'alpha' : 'release') + + mainArtifact(jar) { + displayName = "v$project.version" + } + } + } +} + jar.finalizedBy('reobfJar') publishing {