From 191d83d5d3c0481370523d4396522cbbec5fd44d Mon Sep 17 00:00:00 2001 From: QiuYe Date: Mon, 23 Nov 2026 18:26:14 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E5=8F=91=E8=A1=8C?= =?UTF-8?q?=E5=8C=85=E5=91=BD=E5=90=8D=E5=92=8C=E6=B8=B8=E6=88=8F=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E4=B8=8B=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle/libs.versions.toml | 3 ++- gradle/scripts/jars.gradle | 4 ++-- loader/fabric/build.gradle | 2 +- loader/forge/build.gradle | 2 +- loader/neoforge/build.gradle | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e3aedf0..a3f4981 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,5 +1,6 @@ [versions] -minecraft = "1.21.1" +minecraft = "1.21.1" # 开发运行和测试使用的版本 +minecraftMinimum = "1.21" neoForge = "21.1.265" neoForgeMinimum = "21.1.26" fabricLoader = "0.20.1" diff --git a/gradle/scripts/jars.gradle b/gradle/scripts/jars.gradle index 55194dd..302a06c 100644 --- a/gradle/scripts/jars.gradle +++ b/gradle/scripts/jars.gradle @@ -79,8 +79,8 @@ def sourcesArchive = tasks.named('sourcesJar', Jar) { def publishedSources = fabric ? tasks.named('remapSourcesJar', Jar) : sourcesArchive base { - // 平台子项目名同时用作发行文件名中的 Loader 标识。 - archivesName = "${rootProject.name}-${project.name}-${libs.versions.minecraft.get()}" + // 平台子项目名用作发行文件名中的 Loader 标识。 + archivesName = "${rootProject.name}-${project.name}" } [mainArchive, slimArchive, publishedSources].each { archive -> diff --git a/loader/fabric/build.gradle b/loader/fabric/build.gradle index b7daa9a..69c4bfb 100644 --- a/loader/fabric/build.gradle +++ b/loader/fabric/build.gradle @@ -21,7 +21,7 @@ loom { ext.platformMetadata = [ platform_version_range : ">=${libs.versions.fabricLoaderMinimum.get()}", - minecraft_version_range : '>=1.21' + minecraft_version_range : ">=${libs.versions.minecraftMinimum.get()}" ] apply from: "$rootDir/gradle/scripts/resources.gradle" diff --git a/loader/forge/build.gradle b/loader/forge/build.gradle index bb127db..4079955 100644 --- a/loader/forge/build.gradle +++ b/loader/forge/build.gradle @@ -46,7 +46,7 @@ minecraft { ext.platformMetadata = [ loader_version_range : '[51,)', platform_version_range : "[${libs.versions.forgeLoaderMinimum.get()},62)", - minecraft_version_range : '[1.21,)' + minecraft_version_range : "[${libs.versions.minecraftMinimum.get()},)" ] apply from: "$rootDir/gradle/scripts/resources.gradle" diff --git a/loader/neoforge/build.gradle b/loader/neoforge/build.gradle index 389df19..e94919e 100644 --- a/loader/neoforge/build.gradle +++ b/loader/neoforge/build.gradle @@ -27,7 +27,7 @@ sourceSets.test { ext.platformMetadata = [ loader_version_range : "[${libs.versions.loader.get()},)", platform_version_range : "[${libs.versions.neoForgeMinimum.get()},)", - minecraft_version_range : '[1.21,)' + minecraft_version_range : "[${libs.versions.minecraftMinimum.get()},)" ] apply from: "$rootDir/gradle/scripts/resources.gradle" From 18e9fc01d11e2f73258be3fc8dda5edd5763032a Mon Sep 17 00:00:00 2001 From: QiuYe Date: Mon, 23 Nov 2026 18:27:28 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=B0=86=E6=9E=84=E5=BB=BA=E5=92=8C?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E6=B5=81=E7=A8=8B=E7=BB=9F=E4=B8=80=E5=88=B0?= =?UTF-8?q?=E4=B8=BB=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/actions/build_setup/action.yml | 2 +- .github/json/config-latest.json | 14 +--- .github/json/config.json | 16 ++--- .github/workflows/auto-build.yml | 8 +-- .github/workflows/format-java.yml | 2 +- .github/workflows/manage-issue-labels.yml | 2 +- .github/workflows/publish-on-release.yml | 11 ++- .github/workflows/publish.yml | 84 +++++++++++------------ .github/workflows/sync.yml | 4 +- .github/workflows/update-gradle-cache.yml | 2 +- README.md | 8 ++- 11 files changed, 69 insertions(+), 84 deletions(-) diff --git a/.github/actions/build_setup/action.yml b/.github/actions/build_setup/action.yml index e81e445..6509a48 100644 --- a/.github/actions/build_setup/action.yml +++ b/.github/actions/build_setup/action.yml @@ -31,5 +31,5 @@ runs: uses: gradle/actions/setup-gradle@v4 with: cache-write-only: ${{ inputs.update-cache }} - cache-read-only: ${{ github.ref != 'refs/heads/1.21' }} + cache-read-only: ${{ github.ref != 'refs/heads/main' }} add-job-summary: 'on-failure' diff --git a/.github/json/config-latest.json b/.github/json/config-latest.json index 48ba115..c0e633f 100644 --- a/.github/json/config-latest.json +++ b/.github/json/config-latest.json @@ -19,17 +19,9 @@ "empty_template": "", "ignore_labels": ["ignore changelog"], "tag_resolver": { - "method": "semver", - "filter": { - "pattern": "^(?!v?[0-9\\.]+(-1\\.21)$).+$", - "flags": "gu" - }, - "transformer": { - "pattern": "v?([0-9\\.]+)(-[0-9\\.]+)?", - "target": "$1" - } + "method": "semver" }, "max_pull_requests": 1000, "max_back_track_time_days": 365, - "base_branches": ["1.21"] -} \ No newline at end of file + "base_branches": ["main"] +} diff --git a/.github/json/config.json b/.github/json/config.json index fce0e05..669d0b1 100644 --- a/.github/json/config.json +++ b/.github/json/config.json @@ -21,7 +21,7 @@ "name": "VERSION", "source": "TO_TAG", "transformer": { - "pattern": "v?([0-9\\.]+)(-[0-9\\.]+)?", + "pattern": "^v?(.+)$", "target": "$1" } } @@ -29,17 +29,9 @@ "empty_template": "", "ignore_labels": ["ignore changelog"], "tag_resolver": { - "method": "semver", - "filter": { - "pattern": "^(?!v?[0-9\\.]+(-1\\.21)$).+$", - "flags": "gu" - }, - "transformer": { - "pattern": "v?([0-9\\.]+)(-[0-9\\.]+)?", - "target": "$1" - } + "method": "semver" }, "max_pull_requests": 1000, "max_back_track_time_days": 365, - "base_branches": ["1.21"] -} \ No newline at end of file + "base_branches": ["main"] +} diff --git a/.github/workflows/auto-build.yml b/.github/workflows/auto-build.yml index 8cfb553..e523784 100644 --- a/.github/workflows/auto-build.yml +++ b/.github/workflows/auto-build.yml @@ -2,7 +2,7 @@ name: Latest Build on: push: - branches: ['1.21'] + branches: ['main'] paths: ['**/src/**', '**/*.gradle', 'gradle.properties', 'gradle/**', 'gradlew*'] concurrency: @@ -61,11 +61,11 @@ jobs: if: ${{ env.PUBLISH == 'true' }} uses: andelf/nightly-release@46e2d5f80828ecc5c2c3c819eb31186a7cf2156c with: - tag_name: latest-${{ github.ref_name }} - name: '${{ github.ref_name }}-${{ steps.ver.outputs.version}} SNAPSHOT ${{ env.VERSION_SUFFIX }}' + tag_name: latest + name: 'MixinSplice ${{ steps.ver.outputs.version }} SNAPSHOT ${{ env.VERSION_SUFFIX }}' prerelease: true body: | - The latest build of MixinSplice for Minecraft ${{ github.ref_name }}. + The latest build of MixinSplice for Fabric, Forge, and NeoForge. Please report any [issues](${{ github.server_url }}/${{ github.repository }}/issues). ${{ steps.changelog.outputs.changelog }} files: build/libs/*.jar diff --git a/.github/workflows/format-java.yml b/.github/workflows/format-java.yml index af40321..e07b1fc 100644 --- a/.github/workflows/format-java.yml +++ b/.github/workflows/format-java.yml @@ -3,7 +3,7 @@ name: Java Formatting on: push: - branches: ['1.21'] + branches: ['main'] paths: - '**/src/*/java/**' - '**/src/*/kotlin/**' diff --git a/.github/workflows/manage-issue-labels.yml b/.github/workflows/manage-issue-labels.yml index 618fde0..424def6 100644 --- a/.github/workflows/manage-issue-labels.yml +++ b/.github/workflows/manage-issue-labels.yml @@ -15,7 +15,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - ref: '1.21' + ref: main sparse-checkout: '.github/labeler.yml' - uses: github/issue-labeler@v3.3 with: diff --git a/.github/workflows/publish-on-release.yml b/.github/workflows/publish-on-release.yml index 5fe5088..f21d3a0 100644 --- a/.github/workflows/publish-on-release.yml +++ b/.github/workflows/publish-on-release.yml @@ -17,7 +17,8 @@ jobs: - name: Get Config uses: actions/checkout@v4 with: - ref: ${{ github.ref_name }} + ref: ${{ github.ref }} + fetch-depth: 0 sparse-checkout: '.github/json' - name: Generate changelog id: changelog @@ -30,15 +31,13 @@ jobs: fetchViaCommits: true failOnError: true - publish-21: - name: 1.21.1 + publish: + name: Publish MixinSplice needs: [ meta ] - if: ${{ contains(github.ref_name, '1.21') }} secrets: inherit uses: ./.github/workflows/publish.yml with: simulate: ${{ startsWith(github.event.release.name, 'simulate') || github.repository_owner != 'ExtremelyFrozen' }} tag-name: ${{ github.ref_name }} - version: '1.21' release-body: ${{ github.event.release.body }} - changelog-body: ${{ needs.meta.outputs.CHANGELOG }} \ No newline at end of file + changelog-body: ${{ needs.meta.outputs.CHANGELOG }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3ce1baa..814be47 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,10 +10,6 @@ on: description: 'Tag to build from and upload to' required: true type: string - version: - description: 'Version identifier; 1.21' - required: true - type: string release-body: description: 'Body for published release notes' required: false @@ -36,11 +32,11 @@ jobs: steps: - uses: actions/checkout@v4 with: - ref: ${{ inputs.branch }} + ref: refs/tags/${{ inputs.tag-name }} - name: Setup Build uses: ./.github/actions/build_setup with: - ref: ${{ inputs.branch }} + ref: refs/tags/${{ inputs.tag-name }} - name: Grant execute permission for gradlew run: chmod +x gradlew - name: Get Version @@ -80,37 +76,34 @@ jobs: files: ./*.jar fail_on_unmatched_files: true + # 发布模板按加载器选取制品,游戏版本从 JAR 的元数据读取。 # publish-modrinth: # name: Publish to Modrinth # needs: build # if: ${{ !inputs.simulate }} # runs-on: ubuntu-latest + # strategy: + # matrix: + # loader: [fabric, forge, neoforge] # permissions: # contents: write # steps: # - name: Download artifacts # uses: actions/download-artifact@v4 # with: - # name: build-artifacts-${{ inputs.branch }} + # name: build-artifacts-${{ inputs.tag-name }} # - name: Publish Mod - # env: - # MC_VERSION: ${{ inputs.branch == '1.21' && '1.21.1' || '1.20.1' }} - # LOADER: ${{ inputs.branch == '1.21' && 'neoforge' || 'forge' }} - # JAVA: ${{ inputs.branch == '1.21' && '21' || '17' }} - # VERSION_TYPE: ${{ inputs.branch == '1.21' && 'beta' || 'beta' }} # uses: Kir-Antipov/mc-publish@v3.3.0 # with: - # modrinth-id: aADDBrNC + # modrinth-id: ${{ vars.MODRINTH_PROJECT_ID }} # modrinth-token: ${{ secrets.MODRINTH_TOKEN }} - # files: | - # ./gtmoremachine-${{ env.MC_VERSION }}-${{ needs.build.outputs.ver }}.jar - # ./!(gtmoremachine-${{ env.MC_VERSION }}-${{ needs.build.outputs.ver }}.jar) - # name: 'GTMoreMachine ${{ env.MC_VERSION }}-${{ needs.build.outputs.ver }}' - # version: 'mc${{ env.MC_VERSION }}-${{ needs.build.outputs.ver }}' - # version-type: ${{ env.VERSION_TYPE }} + # files: ./mixinsplice-${{ matrix.loader }}-${{ needs.build.outputs.ver }}.jar + # name: 'MixinSplice ${{ needs.build.outputs.ver }} (${{ matrix.loader }})' + # version: '${{ needs.build.outputs.ver }}-${{ matrix.loader }}' + # version-type: beta # changelog: ${{ inputs.release-body }} - # loaders: ${{ env.LOADER }} - # java: ${{ env.JAVA }} + # loaders: ${{ matrix.loader }} + # java: '21' # fail-mode: fail # # publish-cf: @@ -118,32 +111,28 @@ jobs: # needs: build # if: ${{ !inputs.simulate }} # runs-on: ubuntu-latest + # strategy: + # matrix: + # loader: [fabric, forge, neoforge] # permissions: # contents: write # steps: # - name: Download artifacts # uses: actions/download-artifact@v4 # with: - # name: build-artifacts-${{ inputs.branch }} + # name: build-artifacts-${{ inputs.tag-name }} # - name: Publish Mod - # env: - # MC_VERSION: ${{ inputs.branch == '1.21' && '1.21.1' || '1.20.1' }} - # LOADER: ${{ inputs.branch == '1.21' && 'neoforge' || 'forge' }} - # JAVA: ${{ inputs.branch == '1.21' && '21' || '17' }} - # VERSION_TYPE: ${{ inputs.branch == '1.21' && 'alpha' || 'beta' }} # uses: Kir-Antipov/mc-publish@v3.3.0 # with: - # curseforge-id: 1397216 + # curseforge-id: ${{ vars.CURSEFORGE_PROJECT_ID }} # curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} - # files: | - # ./gtmoremachine-${{ env.MC_VERSION }}-${{ needs.build.outputs.ver }}.jar - # ./!(gtmoremachine-${{ env.MC_VERSION }}-${{ needs.build.outputs.ver }}.jar) - # name: 'GTMoreMachine ${{ env.MC_VERSION }}-${{ needs.build.outputs.ver }}' - # version: 'mc${{ env.MC_VERSION }}-${{ needs.build.outputs.ver }}' - # version-type: ${{ env.VERSION_TYPE }} + # files: ./mixinsplice-${{ matrix.loader }}-${{ needs.build.outputs.ver }}.jar + # name: 'MixinSplice ${{ needs.build.outputs.ver }} (${{ matrix.loader }})' + # version: '${{ needs.build.outputs.ver }}-${{ matrix.loader }}' + # version-type: alpha # changelog: ${{ inputs.release-body }} - # loaders: ${{ env.LOADER }} - # java: ${{ env.JAVA }} + # loaders: ${{ matrix.loader }} + # java: '21' # fail-mode: fail # 发布成功后,通过 PR 更新版本号和变更日志。 @@ -155,26 +144,35 @@ jobs: permissions: contents: write pull-requests: write + env: + RELEASE_VERSION: ${{ needs.build.outputs.ver }} steps: - uses: actions/checkout@v4 with: - ref: ${{ inputs.branch }} + ref: main - name: Bump Version run: | git config user.name 'github-actions[bot]' git config user.email '41898282+github-actions[bot]@users.noreply.github.com' - git switch -C gh/release-${{ inputs.version }} - BUMPED=$(echo ${{ needs.build.outputs.ver }} | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.) - sed -i "s/= ${{ needs.build.outputs.ver }}/= ${BUMPED}/" gradle.properties + git switch -C "gh/release-${RELEASE_VERSION}" + CURRENT=$(sed -n 's/^mod_version = //p' gradle.properties) + if [[ "$CURRENT" != "$RELEASE_VERSION" ]]; then + echo "main is at $CURRENT, expected released version $RELEASE_VERSION" >&2 + exit 1 + fi + BUMPED=$(printf '%s\n' "$RELEASE_VERSION" | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.) + sed -i "s/^mod_version = .*/mod_version = ${BUMPED}/" gradle.properties git commit -am "Bump version to ${BUMPED}" - name: Prepend to CHANGELOG if: inputs.changelog-body + env: + CHANGELOG_BODY: ${{ inputs.changelog-body }} run: | - { head -n 2 CHANGELOG.md; echo -e "${{ inputs.changelog-body }}"; tail -n +3 CHANGELOG.md; } > temp.md && mv temp.md CHANGELOG.md + { head -n 1 CHANGELOG.md; printf '\n%s\n' "$CHANGELOG_BODY"; tail -n +2 CHANGELOG.md; } > temp.md && mv temp.md CHANGELOG.md git commit -am "Updated CHANGELOG" - name: Push and PR env: GH_TOKEN: ${{ github.token }} run: | - git push --force --set-upstream origin gh/release-${{ inputs.version }} - gh pr create -B ${{ inputs.version }} -H gh/release-${{ inputs.version }} --title "RELEASE for ${{ inputs.version }} [no-snapshot]" --body "Created by GH Workflow" --label "ignore changelog" + git push --force --set-upstream origin "gh/release-${RELEASE_VERSION}" + gh pr create --base main --head "gh/release-${RELEASE_VERSION}" --title "RELEASE for ${RELEASE_VERSION} [no-snapshot]" --body "Created by GH Workflow" --label "ignore changelog" diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index e11c4cf..c2c44b8 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -2,7 +2,7 @@ name: Sync Github Folder on: push: - branches: ['1.21'] + branches: ['main'] paths: ['.github/**'] jobs: @@ -17,7 +17,7 @@ jobs: git config user.email '41898282+github-actions[bot]@users.noreply.github.com' git switch -C gh/workflow-sync git fetch origin - git checkout origin/1.21 -- .github + git checkout origin/main -- .github git add .github git commit --allow-empty -m "Sync Workflows" git push --force --set-upstream origin gh/workflow-sync diff --git a/.github/workflows/update-gradle-cache.yml b/.github/workflows/update-gradle-cache.yml index 4f86135..5b9f22f 100644 --- a/.github/workflows/update-gradle-cache.yml +++ b/.github/workflows/update-gradle-cache.yml @@ -3,7 +3,7 @@ name: Update Gradle Cache on: push: - branches: ['1.21'] + branches: ['main'] paths: ['gradle/**', '**/*.gradle', 'gradle.properties', 'gradlew*'] workflow_dispatch: diff --git a/README.md b/README.md index b927599..4a100f4 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,9 @@ dependencies { .\gradlew.bat publishToMavenLocal ``` -共享库、平台主 JAR、源码 JAR 和单独构建的 slim JAR 位于根项目的 `build/libs/`。通过 `publishToMavenLocal` 安装制品后,消费方可使用 `mavenLocal()` 解析依赖。 +共享库、平台主 JAR、源码 JAR 和单独构建的 slim JAR 位于根项目的 `build/libs/`。平台主包命名为 `mixinsplice--<版本>.jar`。通过 `publishToMavenLocal` 安装制品后,消费方可使用 `mavenLocal()` 解析依赖。 + +`main` 上的构建更新 `latest` 快照。正式发布使用项目版本标签,例如 `v0.1.0`。 ## English @@ -150,4 +152,6 @@ Use Java 21 to run the Gradle Wrapper. Set `GRADLE_USER_HOME` to select the Grad .\gradlew.bat publishToMavenLocal ``` -The shared library, platform JARs, sources, and separately built slim JARs are written to the root project's `build/libs/` directory. After running `publishToMavenLocal`, consumer builds can resolve the artifacts from `mavenLocal()`. +The shared library, platform JARs, sources, and separately built slim JARs are written to the root project's `build/libs/` directory. The main platform JARs are named `mixinsplice--.jar`. After running `publishToMavenLocal`, consumer builds can resolve the artifacts from `mavenLocal()`. + +Builds on `main` update the `latest` snapshot. Stable releases use project version tags such as `v0.1.0`. From 86d23b6ed7a5ba2d10744070e466f9363beb16dd Mon Sep 17 00:00:00 2001 From: QiuYe Date: Mon, 23 Nov 2026 19:30:21 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E6=94=B6=E7=AA=84=E4=B8=BB=E5=88=86?= =?UTF-8?q?=E6=94=AF=E8=BF=81=E7=A7=BB=E5=B9=B6=E6=81=A2=E5=A4=8D=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E7=89=88=E6=9C=AC=E5=8C=B9=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/json/config-latest.json | 6 ++- .github/json/config.json | 8 ++- .github/workflows/auto-build.yml | 6 +-- .github/workflows/publish-on-release.yml | 4 +- .github/workflows/publish.yml | 62 +++++++++++------------- README.md | 8 +-- gradle/libs.versions.toml | 3 +- gradle/scripts/jars.gradle | 2 +- loader/fabric/build.gradle | 2 +- loader/forge/build.gradle | 2 +- loader/neoforge/build.gradle | 2 +- 11 files changed, 50 insertions(+), 55 deletions(-) diff --git a/.github/json/config-latest.json b/.github/json/config-latest.json index c0e633f..0da2893 100644 --- a/.github/json/config-latest.json +++ b/.github/json/config-latest.json @@ -19,7 +19,11 @@ "empty_template": "", "ignore_labels": ["ignore changelog"], "tag_resolver": { - "method": "semver" + "method": "semver", + "transformer": { + "pattern": "v?([0-9\\.]+)(-[0-9\\.]+)?", + "target": "$1" + } }, "max_pull_requests": 1000, "max_back_track_time_days": 365, diff --git a/.github/json/config.json b/.github/json/config.json index 669d0b1..1a1a547 100644 --- a/.github/json/config.json +++ b/.github/json/config.json @@ -21,7 +21,7 @@ "name": "VERSION", "source": "TO_TAG", "transformer": { - "pattern": "^v?(.+)$", + "pattern": "v?([0-9\\.]+)(-[0-9\\.]+)?", "target": "$1" } } @@ -29,7 +29,11 @@ "empty_template": "", "ignore_labels": ["ignore changelog"], "tag_resolver": { - "method": "semver" + "method": "semver", + "transformer": { + "pattern": "v?([0-9\\.]+)(-[0-9\\.]+)?", + "target": "$1" + } }, "max_pull_requests": 1000, "max_back_track_time_days": 365, diff --git a/.github/workflows/auto-build.yml b/.github/workflows/auto-build.yml index e523784..bea34d6 100644 --- a/.github/workflows/auto-build.yml +++ b/.github/workflows/auto-build.yml @@ -61,11 +61,11 @@ jobs: if: ${{ env.PUBLISH == 'true' }} uses: andelf/nightly-release@46e2d5f80828ecc5c2c3c819eb31186a7cf2156c with: - tag_name: latest - name: 'MixinSplice ${{ steps.ver.outputs.version }} SNAPSHOT ${{ env.VERSION_SUFFIX }}' + tag_name: latest-${{ github.ref_name }} + name: '${{ github.ref_name }}-${{ steps.ver.outputs.version}} SNAPSHOT ${{ env.VERSION_SUFFIX }}' prerelease: true body: | - The latest build of MixinSplice for Fabric, Forge, and NeoForge. + The latest build of MixinSplice from the ${{ github.ref_name }} branch. Please report any [issues](${{ github.server_url }}/${{ github.repository }}/issues). ${{ steps.changelog.outputs.changelog }} files: build/libs/*.jar diff --git a/.github/workflows/publish-on-release.yml b/.github/workflows/publish-on-release.yml index f21d3a0..8f00602 100644 --- a/.github/workflows/publish-on-release.yml +++ b/.github/workflows/publish-on-release.yml @@ -17,8 +17,7 @@ jobs: - name: Get Config uses: actions/checkout@v4 with: - ref: ${{ github.ref }} - fetch-depth: 0 + ref: ${{ github.ref_name }} sparse-checkout: '.github/json' - name: Generate changelog id: changelog @@ -39,5 +38,6 @@ jobs: with: simulate: ${{ startsWith(github.event.release.name, 'simulate') || github.repository_owner != 'ExtremelyFrozen' }} tag-name: ${{ github.ref_name }} + branch: main release-body: ${{ github.event.release.body }} changelog-body: ${{ needs.meta.outputs.CHANGELOG }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 814be47..578bb6c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,6 +10,10 @@ on: description: 'Tag to build from and upload to' required: true type: string + branch: + description: 'Branch to build from and update after release' + required: true + type: string release-body: description: 'Body for published release notes' required: false @@ -32,11 +36,11 @@ jobs: steps: - uses: actions/checkout@v4 with: - ref: refs/tags/${{ inputs.tag-name }} + ref: ${{ inputs.branch }} - name: Setup Build uses: ./.github/actions/build_setup with: - ref: refs/tags/${{ inputs.tag-name }} + ref: ${{ inputs.branch }} - name: Grant execute permission for gradlew run: chmod +x gradlew - name: Get Version @@ -76,15 +80,11 @@ jobs: files: ./*.jar fail_on_unmatched_files: true - # 发布模板按加载器选取制品,游戏版本从 JAR 的元数据读取。 # publish-modrinth: # name: Publish to Modrinth # needs: build # if: ${{ !inputs.simulate }} # runs-on: ubuntu-latest - # strategy: - # matrix: - # loader: [fabric, forge, neoforge] # permissions: # contents: write # steps: @@ -93,16 +93,18 @@ jobs: # with: # name: build-artifacts-${{ inputs.tag-name }} # - name: Publish Mod + # env: + # LOADER: neoforge # uses: Kir-Antipov/mc-publish@v3.3.0 # with: - # modrinth-id: ${{ vars.MODRINTH_PROJECT_ID }} + # modrinth-id: aADDBrNC # modrinth-token: ${{ secrets.MODRINTH_TOKEN }} - # files: ./mixinsplice-${{ matrix.loader }}-${{ needs.build.outputs.ver }}.jar - # name: 'MixinSplice ${{ needs.build.outputs.ver }} (${{ matrix.loader }})' - # version: '${{ needs.build.outputs.ver }}-${{ matrix.loader }}' + # files: ./mixinsplice-${{ env.LOADER }}-${{ needs.build.outputs.ver }}.jar + # name: 'MixinSplice ${{ needs.build.outputs.ver }}' + # version: ${{ needs.build.outputs.ver }} # version-type: beta # changelog: ${{ inputs.release-body }} - # loaders: ${{ matrix.loader }} + # loaders: ${{ env.LOADER }} # java: '21' # fail-mode: fail # @@ -111,9 +113,6 @@ jobs: # needs: build # if: ${{ !inputs.simulate }} # runs-on: ubuntu-latest - # strategy: - # matrix: - # loader: [fabric, forge, neoforge] # permissions: # contents: write # steps: @@ -122,16 +121,18 @@ jobs: # with: # name: build-artifacts-${{ inputs.tag-name }} # - name: Publish Mod + # env: + # LOADER: neoforge # uses: Kir-Antipov/mc-publish@v3.3.0 # with: - # curseforge-id: ${{ vars.CURSEFORGE_PROJECT_ID }} + # curseforge-id: 1397216 # curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} - # files: ./mixinsplice-${{ matrix.loader }}-${{ needs.build.outputs.ver }}.jar - # name: 'MixinSplice ${{ needs.build.outputs.ver }} (${{ matrix.loader }})' - # version: '${{ needs.build.outputs.ver }}-${{ matrix.loader }}' + # files: ./mixinsplice-${{ env.LOADER }}-${{ needs.build.outputs.ver }}.jar + # name: 'MixinSplice ${{ needs.build.outputs.ver }}' + # version: ${{ needs.build.outputs.ver }} # version-type: alpha # changelog: ${{ inputs.release-body }} - # loaders: ${{ matrix.loader }} + # loaders: ${{ env.LOADER }} # java: '21' # fail-mode: fail @@ -144,35 +145,26 @@ jobs: permissions: contents: write pull-requests: write - env: - RELEASE_VERSION: ${{ needs.build.outputs.ver }} steps: - uses: actions/checkout@v4 with: - ref: main + ref: ${{ inputs.branch }} - name: Bump Version run: | git config user.name 'github-actions[bot]' git config user.email '41898282+github-actions[bot]@users.noreply.github.com' - git switch -C "gh/release-${RELEASE_VERSION}" - CURRENT=$(sed -n 's/^mod_version = //p' gradle.properties) - if [[ "$CURRENT" != "$RELEASE_VERSION" ]]; then - echo "main is at $CURRENT, expected released version $RELEASE_VERSION" >&2 - exit 1 - fi - BUMPED=$(printf '%s\n' "$RELEASE_VERSION" | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.) - sed -i "s/^mod_version = .*/mod_version = ${BUMPED}/" gradle.properties + git switch -C gh/release-${{ inputs.branch }} + BUMPED=$(echo ${{ needs.build.outputs.ver }} | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.) + sed -i "s/= ${{ needs.build.outputs.ver }}/= ${BUMPED}/" gradle.properties git commit -am "Bump version to ${BUMPED}" - name: Prepend to CHANGELOG if: inputs.changelog-body - env: - CHANGELOG_BODY: ${{ inputs.changelog-body }} run: | - { head -n 1 CHANGELOG.md; printf '\n%s\n' "$CHANGELOG_BODY"; tail -n +2 CHANGELOG.md; } > temp.md && mv temp.md CHANGELOG.md + { head -n 2 CHANGELOG.md; echo -e "${{ inputs.changelog-body }}"; tail -n +3 CHANGELOG.md; } > temp.md && mv temp.md CHANGELOG.md git commit -am "Updated CHANGELOG" - name: Push and PR env: GH_TOKEN: ${{ github.token }} run: | - git push --force --set-upstream origin "gh/release-${RELEASE_VERSION}" - gh pr create --base main --head "gh/release-${RELEASE_VERSION}" --title "RELEASE for ${RELEASE_VERSION} [no-snapshot]" --body "Created by GH Workflow" --label "ignore changelog" + git push --force --set-upstream origin gh/release-${{ inputs.branch }} + gh pr create -B ${{ inputs.branch }} -H gh/release-${{ inputs.branch }} --title "RELEASE for ${{ inputs.branch }} [no-snapshot]" --body "Created by GH Workflow" --label "ignore changelog" diff --git a/README.md b/README.md index 4a100f4..b927599 100644 --- a/README.md +++ b/README.md @@ -75,9 +75,7 @@ dependencies { .\gradlew.bat publishToMavenLocal ``` -共享库、平台主 JAR、源码 JAR 和单独构建的 slim JAR 位于根项目的 `build/libs/`。平台主包命名为 `mixinsplice--<版本>.jar`。通过 `publishToMavenLocal` 安装制品后,消费方可使用 `mavenLocal()` 解析依赖。 - -`main` 上的构建更新 `latest` 快照。正式发布使用项目版本标签,例如 `v0.1.0`。 +共享库、平台主 JAR、源码 JAR 和单独构建的 slim JAR 位于根项目的 `build/libs/`。通过 `publishToMavenLocal` 安装制品后,消费方可使用 `mavenLocal()` 解析依赖。 ## English @@ -152,6 +150,4 @@ Use Java 21 to run the Gradle Wrapper. Set `GRADLE_USER_HOME` to select the Grad .\gradlew.bat publishToMavenLocal ``` -The shared library, platform JARs, sources, and separately built slim JARs are written to the root project's `build/libs/` directory. The main platform JARs are named `mixinsplice--.jar`. After running `publishToMavenLocal`, consumer builds can resolve the artifacts from `mavenLocal()`. - -Builds on `main` update the `latest` snapshot. Stable releases use project version tags such as `v0.1.0`. +The shared library, platform JARs, sources, and separately built slim JARs are written to the root project's `build/libs/` directory. After running `publishToMavenLocal`, consumer builds can resolve the artifacts from `mavenLocal()`. diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a3f4981..e3aedf0 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,5 @@ [versions] -minecraft = "1.21.1" # 开发运行和测试使用的版本 -minecraftMinimum = "1.21" +minecraft = "1.21.1" neoForge = "21.1.265" neoForgeMinimum = "21.1.26" fabricLoader = "0.20.1" diff --git a/gradle/scripts/jars.gradle b/gradle/scripts/jars.gradle index 302a06c..a7e5a38 100644 --- a/gradle/scripts/jars.gradle +++ b/gradle/scripts/jars.gradle @@ -79,7 +79,7 @@ def sourcesArchive = tasks.named('sourcesJar', Jar) { def publishedSources = fabric ? tasks.named('remapSourcesJar', Jar) : sourcesArchive base { - // 平台子项目名用作发行文件名中的 Loader 标识。 + // 平台子项目名同时用作发行文件名中的 Loader 标识。 archivesName = "${rootProject.name}-${project.name}" } diff --git a/loader/fabric/build.gradle b/loader/fabric/build.gradle index 69c4bfb..b7daa9a 100644 --- a/loader/fabric/build.gradle +++ b/loader/fabric/build.gradle @@ -21,7 +21,7 @@ loom { ext.platformMetadata = [ platform_version_range : ">=${libs.versions.fabricLoaderMinimum.get()}", - minecraft_version_range : ">=${libs.versions.minecraftMinimum.get()}" + minecraft_version_range : '>=1.21' ] apply from: "$rootDir/gradle/scripts/resources.gradle" diff --git a/loader/forge/build.gradle b/loader/forge/build.gradle index 4079955..bb127db 100644 --- a/loader/forge/build.gradle +++ b/loader/forge/build.gradle @@ -46,7 +46,7 @@ minecraft { ext.platformMetadata = [ loader_version_range : '[51,)', platform_version_range : "[${libs.versions.forgeLoaderMinimum.get()},62)", - minecraft_version_range : "[${libs.versions.minecraftMinimum.get()},)" + minecraft_version_range : '[1.21,)' ] apply from: "$rootDir/gradle/scripts/resources.gradle" diff --git a/loader/neoforge/build.gradle b/loader/neoforge/build.gradle index e94919e..389df19 100644 --- a/loader/neoforge/build.gradle +++ b/loader/neoforge/build.gradle @@ -27,7 +27,7 @@ sourceSets.test { ext.platformMetadata = [ loader_version_range : "[${libs.versions.loader.get()},)", platform_version_range : "[${libs.versions.neoForgeMinimum.get()},)", - minecraft_version_range : "[${libs.versions.minecraftMinimum.get()},)" + minecraft_version_range : '[1.21,)' ] apply from: "$rootDir/gradle/scripts/resources.gradle" From 485b84e4c65f58e30878025d47557611ae21f690 Mon Sep 17 00:00:00 2001 From: QiuYe Date: Mon, 23 Nov 2026 19:47:55 +0800 Subject: [PATCH 4/4] UpData --- .github/workflows/auto-build.yml | 6 +-- .github/workflows/publish-on-release.yml | 1 - .github/workflows/publish.yml | 60 ------------------------ 3 files changed, 3 insertions(+), 64 deletions(-) diff --git a/.github/workflows/auto-build.yml b/.github/workflows/auto-build.yml index bea34d6..e523784 100644 --- a/.github/workflows/auto-build.yml +++ b/.github/workflows/auto-build.yml @@ -61,11 +61,11 @@ jobs: if: ${{ env.PUBLISH == 'true' }} uses: andelf/nightly-release@46e2d5f80828ecc5c2c3c819eb31186a7cf2156c with: - tag_name: latest-${{ github.ref_name }} - name: '${{ github.ref_name }}-${{ steps.ver.outputs.version}} SNAPSHOT ${{ env.VERSION_SUFFIX }}' + tag_name: latest + name: 'MixinSplice ${{ steps.ver.outputs.version }} SNAPSHOT ${{ env.VERSION_SUFFIX }}' prerelease: true body: | - The latest build of MixinSplice from the ${{ github.ref_name }} branch. + The latest build of MixinSplice for Fabric, Forge, and NeoForge. Please report any [issues](${{ github.server_url }}/${{ github.repository }}/issues). ${{ steps.changelog.outputs.changelog }} files: build/libs/*.jar diff --git a/.github/workflows/publish-on-release.yml b/.github/workflows/publish-on-release.yml index 8f00602..26a73e7 100644 --- a/.github/workflows/publish-on-release.yml +++ b/.github/workflows/publish-on-release.yml @@ -38,6 +38,5 @@ jobs: with: simulate: ${{ startsWith(github.event.release.name, 'simulate') || github.repository_owner != 'ExtremelyFrozen' }} tag-name: ${{ github.ref_name }} - branch: main release-body: ${{ github.event.release.body }} changelog-body: ${{ needs.meta.outputs.CHANGELOG }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 578bb6c..8188e8e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,10 +10,6 @@ on: description: 'Tag to build from and upload to' required: true type: string - branch: - description: 'Branch to build from and update after release' - required: true - type: string release-body: description: 'Body for published release notes' required: false @@ -80,62 +76,6 @@ jobs: files: ./*.jar fail_on_unmatched_files: true - # publish-modrinth: - # name: Publish to Modrinth - # needs: build - # if: ${{ !inputs.simulate }} - # runs-on: ubuntu-latest - # permissions: - # contents: write - # steps: - # - name: Download artifacts - # uses: actions/download-artifact@v4 - # with: - # name: build-artifacts-${{ inputs.tag-name }} - # - name: Publish Mod - # env: - # LOADER: neoforge - # uses: Kir-Antipov/mc-publish@v3.3.0 - # with: - # modrinth-id: aADDBrNC - # modrinth-token: ${{ secrets.MODRINTH_TOKEN }} - # files: ./mixinsplice-${{ env.LOADER }}-${{ needs.build.outputs.ver }}.jar - # name: 'MixinSplice ${{ needs.build.outputs.ver }}' - # version: ${{ needs.build.outputs.ver }} - # version-type: beta - # changelog: ${{ inputs.release-body }} - # loaders: ${{ env.LOADER }} - # java: '21' - # fail-mode: fail - # - # publish-cf: - # name: Publish to CF - # needs: build - # if: ${{ !inputs.simulate }} - # runs-on: ubuntu-latest - # permissions: - # contents: write - # steps: - # - name: Download artifacts - # uses: actions/download-artifact@v4 - # with: - # name: build-artifacts-${{ inputs.tag-name }} - # - name: Publish Mod - # env: - # LOADER: neoforge - # uses: Kir-Antipov/mc-publish@v3.3.0 - # with: - # curseforge-id: 1397216 - # curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} - # files: ./mixinsplice-${{ env.LOADER }}-${{ needs.build.outputs.ver }}.jar - # name: 'MixinSplice ${{ needs.build.outputs.ver }}' - # version: ${{ needs.build.outputs.ver }} - # version-type: alpha - # changelog: ${{ inputs.release-body }} - # loaders: ${{ env.LOADER }} - # java: '21' - # fail-mode: fail - # 发布成功后,通过 PR 更新版本号和变更日志。 bump-version-and-changelog: name: Bump Version and Build Changelog