Add CurseForge plugin

This commit is contained in:
raoulvdberge
2021-12-12 23:28:43 +01:00
parent 0906b51b99
commit 548c77252f
2 changed files with 47 additions and 21 deletions

View File

@@ -7,7 +7,7 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Get tag name - name: Get tag name
uses: olegtarasov/get-tag@v2.1 uses: olegtarasov/get-tag@v2.1
id: tagName id: tagName
- name: Validate semver - name: Validate semver
@@ -47,26 +47,32 @@ jobs:
id: changelog_reader id: changelog_reader
uses: mindsers/changelog-reader-action@v2 uses: mindsers/changelog-reader-action@v2
with: with:
version: 'Unreleased' version: 'Unreleased'
path: ./CHANGELOG.md path: ./CHANGELOG.md
- name: Release on GitHub - name: Release on GitHub
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
id: ghRelease id: ghRelease
with: with:
body: ${{ steps.changelog_reader.outputs.changes }} body: ${{ steps.changelog_reader.outputs.changes }}
name: ${{ steps.tagName.outputs.tag }} name: ${{ steps.tagName.outputs.tag }}
files: | files: |
build/libs/*.jar build/libs/*.jar
# This is necessary because the Discord action doesn't support GH actions variable expansion? - name: Release on CurseForge
- name: Set release URL run: ./gradlew curseforge
run: | env:
echo "RELEASE_URL=${{ steps.ghRelease.outputs.url }}" >> $GITHUB_ENV RELEASE: ${{ steps.tagName.outputs.tag }}
- name: Notify Discord CHANGELOG: ${{ steps.changelog_reader.outputs.changes }}
uses: Ilshidur/action-discord@0.3.2 CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
with: # This is necessary because the Discord action doesn't support GH actions variable expansion?
args: 'Refined Storage {{ GIT_TAG_NAME }} has been released! {{ RELEASE_URL }}' - name: Set release URL
env: run: |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} 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 - name: Notify Twitter
uses: ethomson/send-tweet-action@v1 uses: ethomson/send-tweet-action@v1
with: with:

View File

@@ -8,6 +8,10 @@ buildscript {
} }
} }
plugins {
id 'com.matthewprenger.cursegradle' version '1.4.0'
}
repositories { repositories {
maven { maven {
url = "https://dvs1.progwml6.com/files/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') jar.finalizedBy('reobfJar')
publishing { publishing {