Publishing is easier in the actions

This commit is contained in:
tibs 2022-08-19 12:33:45 -04:00
parent 991594e20e
commit a966b104f1
Signed by untrusted user who does not match committer: tibs
GPG key ID: 047833989F50F88F
4 changed files with 21 additions and 41 deletions

View file

@ -20,6 +20,7 @@ jobs:
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: | path: |
.gradle
~/.gradle/caches ~/.gradle/caches
~/.gradle/wrapper ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}

View file

@ -23,6 +23,7 @@ jobs:
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: | path: |
.gradle
~/.gradle/caches ~/.gradle/caches
~/.gradle/wrapper ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
@ -32,16 +33,25 @@ jobs:
uses: gradle/wrapper-validation-action@v1 uses: gradle/wrapper-validation-action@v1
- name: Build and publish with Gradle - name: Build and publish with Gradle
run: ./gradlew build modrinth curseforge run: ./gradlew build publish
env: env:
MAVEN_URL: ${{ secrets.MAVEN_URL }} MAVEN_URL: ${{ secrets.MAVEN_URL }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
- name: Upload build artifacts - name: Upload artifacts to Modrinth, Curseforge and GitHub
uses: AButler/upload-release-assets@v2.0 uses: Kir-Antipov/mc-publish@v3.1
with: with:
files: 'build/libs/!(*-sources).jar' modrinth-id: 5AgJnN8I
repo-token: ${{ secrets.GITHUB_TOKEN }} modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
curseforge-id: 564870
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
files: build/libs/!(*-sources).jar
loaders: |
fabric
quilt

View file

@ -3,8 +3,6 @@ plugins {
alias(libs.plugins.loom.quiltflower) alias(libs.plugins.loom.quiltflower)
alias(libs.plugins.qmol) alias(libs.plugins.qmol)
alias(libs.plugins.grgit) alias(libs.plugins.grgit)
alias(libs.plugins.minotaur)
alias(libs.plugins.cursegradle)
id "maven-publish" id "maven-publish"
} }
@ -66,33 +64,6 @@ jar {
} }
} }
modrinth {
projectId = "5AgJnN8I"
uploadFile = remapJar
}
tasks.modrinth.dependsOn remapJar
def ENV = System.getenv()
curseforge {
if (ENV.CURSEFORGE_TOKEN) {
apiKey = ENV.CURSEFORGE_TOKEN
}
project {
id = "564870"
changelog = "No changelog provided"
releaseType = "release"
addGameVersion libs.versions.minecraft.get()
addGameVersion "Fabric"
addGameVersion "Quilt"
mainArtifact(jar) {
displayName = "Cauldron Dyeing ${project.mod_version}"
}
}
}
tasks.curseforge.dependsOn remapJar
publishing { publishing {
publications { publications {
mavenJava(MavenPublication) { mavenJava(MavenPublication) {
@ -102,10 +73,10 @@ publishing {
repositories { repositories {
maven { maven {
url = ENV.MAVEN_URL url = System.getenv("MAVEN_URL")
credentials { credentials {
username = ENV.MAVEN_USERNAME username = System.getenv("MAVEN_USERNAME")
password = ENV.MAVEN_PASSWORD password = System.getenv("MAVEN_PASSWORD")
} }
} }
} }

View file

@ -19,5 +19,3 @@ fabric_loom = { id = "fabric-loom", version = "0.12.+" }
loom_quiltflower = { id = "io.github.juuxel.loom-quiltflower", version = "1.7.+" } loom_quiltflower = { id = "io.github.juuxel.loom-quiltflower", version = "1.7.+" }
qmol = { id = "org.quiltmc.quilt-mappings-on-loom", version = "4.2.0" } qmol = { id = "org.quiltmc.quilt-mappings-on-loom", version = "4.2.0" }
grgit = { id = "org.ajoberstar.grgit", version = "5.+" } grgit = { id = "org.ajoberstar.grgit", version = "5.+" }
minotaur = { id = "com.modrinth.minotaur", version = "2.+" }
cursegradle = { id = "com.matthewprenger.cursegradle", version = "1.+" }