Skip to content

Commit

Permalink
Add release logic
Browse files Browse the repository at this point in the history
  • Loading branch information
MsRandom committed Nov 13, 2022
1 parent d8e08cb commit aa1c854
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 3 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Release
on: [
workflow_dispatch
]

jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v1
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
- run: chmod +x ./gradlew
- run: ./gradlew publishUnified
env:
CURSE_TOKEN: ${{ secrets.CURSE_TOKEN }}
CURSE_PROJECT: ${{ secrets.CURSE_PROJECT }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
MODRINTH_PROJECT: ${{ secrets.MODRINTH_PROJECT }}
41 changes: 40 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.0-SNAPSHOT" apply false

id "me.shedaniel.unified-publishing" version "0.1.+"
}

architectury {
Expand All @@ -9,6 +11,7 @@ architectury {

subprojects {
apply plugin: "dev.architectury.loom"
apply plugin: "me.shedaniel.unified-publishing"

loom {
silentMojangMappingsLicense()
Expand All @@ -18,6 +21,42 @@ subprojects {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
mappings loom.officialMojangMappings()
}

if (name != "common") {
var modLoader = name

unifiedPublishing {
project {
var env = System.getenv()
var curseToken = env.CURSE_TOKEN
var modrinthToken = env.MODRINTH_TOKEN
var changelogFile = rootProject.file("changelog.txt")

gameVersions = [minecraft_version]
gameLoaders = [modLoader]

mainPublication(tasks.remapJar)

if (changelogFile.exists()) {
changelog = changelogFile.text
}

if (curseToken != null) {
curseforge {
token = curseToken
id = env.CURSE_PROJECT
}
}

if (modrinthToken != null) {
modrinth {
token = modrinthToken
id = env.MODRINTH_PROJECT
}
}
}
}
}
}

allprojects {
Expand Down Expand Up @@ -48,4 +87,4 @@ allprojects {
java {
withSourcesJar()
}
}
}
13 changes: 12 additions & 1 deletion fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,15 @@ publishing {
}
}
}
}
}

unifiedPublishing {
project {
relations {
depends {
curseforge = "fabric-api"
modrinth = "fabric-api"
}
}
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit aa1c854

Please sign in to comment.