Skip to content

Commit

Permalink
添加模组自动发布
Browse files Browse the repository at this point in the history
  • Loading branch information
TexBlock committed Feb 4, 2024
1 parent c9c8bf1 commit 8d38d70
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 4 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish Release

on:
workflow_dispatch:
release:
types:
- published

permissions:
contents: write

jobs:
Build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 20
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 20
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'build.gradle') }}
- uses: gradle/wrapper-validation-action@v1
- run: |
chmod +x gradlew
./gradlew mergeJars publishMods --stacktrace -Porg.gradle.parallel.threads=4
env:
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
Empty file added CHANGELOG.md
Empty file.
37 changes: 36 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "io.github.pacifistmc.forgix" version "1.2.6"
id "dev.architectury.loom" version "1.3-SNAPSHOT" apply false
id "dev.architectury.loom" version "1.4-SNAPSHOT" apply false
id "me.modmuss50.mod-publish-plugin" version "0.4.5"
}

architectury {
Expand Down Expand Up @@ -59,3 +60,37 @@ forgix {
jarLocation = "build/libs/${rootProject.archives_base_name}-fabric-${ rootProject.version }.jar"
}
}

publishMods {
file = file(forgix.getOutputDir() + "/" + forgix.getMergedJarName())
changelog = file("CHANGELOG.md").getText('UTF-8')
type = STABLE
modLoaders = ["fabric", "forge"]

var CURSEFORGE_TOKEN = project.findProperty("CURSEFORGE_TOKEN") ?: System.getenv("CURSEFORGE_TOKEN")
if (CURSEFORGE_TOKEN != null) {
curseforge {
projectId = rootProject.curseforge_id
accessToken = providers.environmentVariable(CURSEFORGE_TOKEN as Provider<String>)
minecraftVersions = ["1.16.4", "1.16.5"]

requires {
slug = "architectury-api"
}
}
}


var MODRINTH_TOKEN = project.findProperty("MODRINTH_TOKEN") ?: System.getenv("MODRINTH_TOKEN")
if (MODRINTH_TOKEN != null) {
modrinth {
projectId = rootProject.modrinth_id
accessToken = providers.environmentVariable(MODRINTH_TOKEN as Provider<String>)
minecraftVersions = ["1.16.4", "1.16.5"]
}

requires {
slug = "architectury-api"
}
}
}
6 changes: 4 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ org.gradle.jvmargs=-Xmx2048M

minecraft_version=1.16.5
enabled_platforms=fabric,forge

yarn_mappings=1.16.5+build.10

archives_base_name=VMTranslationUpdate
mod_version=2.3
mod_version=2.4
maven_group=top.vmctcn

architectury_version=1.32.68
Expand All @@ -17,3 +16,6 @@ fabric_loader_version=0.14.9
fabric_api_version=0.42.0+1.16

forge_version=1.16.5-36.2.41

curseforge_id=890229
modrinth_id=wvCSIW08
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-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 8d38d70

Please sign in to comment.