Skip to content

Commit

Permalink
🌟修改构建脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
Gu-ZT committed Dec 19, 2024
1 parent 88bdbb8 commit 9167a0e
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 184 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
name: CI for Mod
on:
workflow_dispatch:
push:
branches:
- releases/**
paths:
- src/**
- common/**
- fabric/**
- forge/**
- neoforge/**
- build.gradle
- gradle.properties
- settings.gradle

jobs:
gametest:
secrets: inherit
uses: ./.github/workflows/gametest.yml
build:
runs-on: ubuntu-latest
env:
Expand Down Expand Up @@ -54,17 +52,14 @@ jobs:
- name: Get Version
id: version
run: |
MESSAGE=$(ls forge/build/libs/* | grep sources.jar -v | grep shadow.jar -v | grep slim.jar -v | awk -F '${{ steps.properties.outputs.mod_id }}-forge-|.jar' '{print $2}')
MESSAGE=$(ls build/libs/* | grep sources.jar -v | grep shadow.jar -v | grep slim.jar -v | awk -F '${{ steps.properties.outputs.mod_id }}-neoforge-|.jar' '{print $2}')
echo "version=$MESSAGE" >> $GITHUB_OUTPUT
- name: capture build artifacts
uses: actions/upload-artifact@v4.3.3
with:
name: "${{ steps.properties.outputs.mod_name }} ${{ steps.version.outputs.version }}"
path: |
fabric/build/libs/${{ steps.properties.outputs.mod_id }}-fabric-${{ steps.version.outputs.version }}.jar
forge/build/libs/${{ steps.properties.outputs.mod_id }}-forge-${{ steps.version.outputs.version }}.jar
neoforge/build/libs/${{ steps.properties.outputs.mod_id }}-neoforge-${{ steps.version.outputs.version }}.jar
path: build/libs/${{ steps.properties.outputs.mod_id }}-neoforge-${{ steps.version.outputs.version }}.jar

- name: Publish to maven
run: ./gradlew publish
Expand All @@ -73,3 +68,9 @@ jobs:
MAVEN_USERNAME: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASS }}
continue-on-error: true

- name: gametest
uses: Anvil-Dev/dedicated-server-launch-test@1.21.1-neoforge
with:
mod: build/libs/${{ steps.properties.outputs.mod_id }}-neoforge-${{ steps.version.outputs.version }}.jar
extra-mods: patchouli:1.21-87-neoforge cloth-config:15.0.140+neoforge
67 changes: 0 additions & 67 deletions .github/workflows/dev-ci.yml

This file was deleted.

41 changes: 0 additions & 41 deletions .github/workflows/gametest.yml

This file was deleted.

21 changes: 12 additions & 9 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
name: Pull Request Check
on:
workflow_dispatch:
pull_request:
branches:
- releases/**
paths:
- src/**
- common/**
- fabric/**
- forge/**
- neoforge/**
- build.gradle
- gradle.properties
- settings.gradle

jobs:
gametest:
secrets: inherit
uses: ./.github/workflows/gametest.yml
build:
runs-on: ubuntu-latest
env:
Expand Down Expand Up @@ -52,14 +52,17 @@ jobs:
- name: Get Version
id: version
run: |
MESSAGE=$(ls forge/build/libs/* | grep sources.jar -v | grep shadow.jar -v | grep slim.jar -v | awk -F '${{ steps.properties.outputs.mod_id }}-forge-|.jar' '{print $2}')
MESSAGE=$(ls build/libs/* | grep sources.jar -v | grep shadow.jar -v | grep slim.jar -v | awk -F '${{ steps.properties.outputs.mod_id }}-neoforge-|.jar' '{print $2}')
echo "version=$MESSAGE" >> $GITHUB_OUTPUT
- name: capture build artifacts
uses: actions/upload-artifact@v4.3.3
with:
name: "${{ steps.properties.outputs.mod_name }} ${{ steps.version.outputs.version }}"
path: |
fabric/build/libs/${{ steps.properties.outputs.mod_id }}-fabric-${{ steps.version.outputs.version }}.jar
forge/build/libs/${{ steps.properties.outputs.mod_id }}-forge-${{ steps.version.outputs.version }}.jar
neoforge/build/libs/${{ steps.properties.outputs.mod_id }}-neoforge-${{ steps.version.outputs.version }}.jar
path: build/libs/${{ steps.properties.outputs.mod_id }}-neoforge-${{ steps.version.outputs.version }}.jar

- name: gametest
uses: Anvil-Dev/dedicated-server-launch-test@1.21.1-neoforge
with:
mod: build/libs/${{ steps.properties.outputs.mod_id }}-neoforge-${{ steps.version.outputs.version }}.jar
extra-mods: patchouli:1.21-87-neoforge cloth-config:15.0.140+neoforge
64 changes: 15 additions & 49 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
name: Upload Release Asset
on:
workflow_dispatch:
release:
types: [ published ]

jobs:
build:
permissions: write-all
runs-on: ubuntu-latest
env:
CI_BUILD: false
PR_BUILD: false
VERSION_TYPE: ${{ github.event.release.prerelease && 'alpha' || 'release' }}
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4

- name: validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
uses: gradle/actions/wrapper-validation@v3

- name: Read Properties
id: 'properties'
Expand Down Expand Up @@ -44,25 +45,14 @@ jobs:
- name: Get Version
id: version
run: |
MESSAGE=$(ls forge/build/libs/* | grep sources.jar -v | grep shadow.jar -v | grep slim.jar -v | awk -F '${{ steps.properties.outputs.mod_id }}-forge-|.jar' '{print $2}')
MESSAGE=$(ls build/libs/* | grep sources.jar -v | grep shadow.jar -v | grep slim.jar -v | awk -F '${{ steps.properties.outputs.mod_id }}-neoforge-|.jar' '{print $2}')
echo "version=$MESSAGE" >> $GITHUB_OUTPUT
- name: capture build artifacts
uses: actions/upload-artifact@v3.1.1
uses: actions/upload-artifact@v4.3.3
with:
name: "${{ steps.properties.outputs.mod_name }} ${{ steps.version.outputs.version }}"
path: |
fabric/build/libs/${{ steps.properties.outputs.mod_id }}-fabric-${{ steps.version.outputs.version }}.jar
forge/build/libs/${{ steps.properties.outputs.mod_id }}-forge-${{ steps.version.outputs.version }}.jar
neoforge/build/libs/${{ steps.properties.outputs.mod_id }}-neoforge-${{ steps.version.outputs.version }}.jar
- name: Upload Release Jar
uses: softprops/action-gh-release@v0.1.15
with:
files: |
fabric/build/libs/${{ steps.properties.outputs.mod_id }}-fabric-${{ steps.version.outputs.version }}.jar
forge/build/libs/${{ steps.properties.outputs.mod_id }}-forge-${{ steps.version.outputs.version }}.jar
neoforge/build/libs/${{ steps.properties.outputs.mod_id }}-neoforge-${{ steps.version.outputs.version }}.jar
path: build/libs/${{ steps.properties.outputs.mod_id }}-neoforge-${{ steps.version.outputs.version }}.jar

- name: Publish to maven
run: ./gradlew publish
Expand All @@ -71,50 +61,26 @@ jobs:
MAVEN_USERNAME: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASS }}
continue-on-error: true
#
# - name: publish forge mc mod
# uses: Kir-Antipov/mc-publish@v3.3
# continue-on-error: true
# with:
# name: "${{ steps.properties.outputs.mod_name }} For Forge v${{ steps.version.outputs.version }}"
# version: ${{ steps.version.outputs.version }}
# game-versions: 1.20.1
# version-type: ${{ env.VERSION_TYPE }}
# java: 17
# fail-mode: skip
# changelog: ${{ github.event.release.body }}
#
# modrinth-id: "****"
# modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
# modrinth-featured: true
#
# curseforge-id: "****"
# curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
#
# files: |
# forge/build/libs/${{ steps.properties.outputs.mod_id }}-forge-${{ steps.version.outputs.version }}.jar
# forge/build/libs/${{ steps.properties.outputs.mod_id }}-forge-${{ steps.version.outputs.version }}-sources.jar
#
#
# - name: publish fabric mc mod

# - name: publish neoforge mc mod
# uses: Kir-Antipov/mc-publish@v3.3
# continue-on-error: true
# with:
# name: "${{ steps.properties.outputs.mod_name }} For Fabric v${{ steps.version.outputs.version }}"
# name: "${{ steps.properties.outputs.mod_name }} For NeoForge v${{ steps.version.outputs.version }}"
# version: ${{ steps.version.outputs.version }}
# game-versions: 1.20.1
# game-versions: 1.21.1
# version-type: ${{ env.VERSION_TYPE }}
# java: 17
# java: 21
# fail-mode: skip
# changelog: ${{ github.event.release.body }}
#
# modrinth-id: "****"
# modrinth-id: ${{ steps.properties.outputs.modrinth_id }}
# modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
# modrinth-featured: true
#
# curseforge-id: "****"
# curseforge-id: ${{ steps.properties.outputs.curseforge_id }}
# curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
#
# files: |
# fabric/build/libs/${{ steps.properties.outputs.mod_id }}-fabric-${{ steps.version.outputs.version }}.jar
# fabric/build/libs/${{ steps.properties.outputs.mod_id }}-fabric-${{ steps.version.outputs.version }}-sources.jar
# build/libs/${{ steps.version.properties.mod_id }}-neoforge-${{ steps.version.outputs.version }}.jar
# build/libs/${{ steps.version.properties.mod_id }}-neoforge-${{ steps.version.outputs.version }}-sources.jar
4 changes: 0 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ repositories {
mavenLocal()
}

base {
archivesName = mod_id
}

java.toolchain.languageVersion = JavaLanguageVersion.of(21)

neoForge {
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ org.gradle.configuration-cache=true
## Environment Properties
# You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge
# The Minecraft version must agree with the Neo version to get a valid artifact
minecraft_version=1.21.0
minecraft_version=1.21.1
# The Minecraft version range can use any release version of Minecraft as bounds.
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
# as they do not follow standard versioning conventions.
minecraft_version_range=[1.21.0,1.22)
minecraft_version_range=[1.21.1,1.22)
# The Neo version must agree with the Minecraft version to get a valid artifact
neo_version=21.0.167
neo_version=21.1.79
# The Neo version range can use any version of Neo as bounds
neo_version_range=[21,)
# The loader version range can only use the major version of FML as bounds
loader_version_range=[4,)
parchment_minecraft_version=1.21
parchment_mappings_version=2024.07.28
parchment_minecraft_version=1.21.1
parchment_mappings_version=2024.11.17
## Mod Properties
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
# Must match the String constant located in the main mod class annotated with @Mod.
Expand Down
2 changes: 2 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ pluginManagement {
plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
}

rootProject.name = mod_id + "-neoforge" + "-" + minecraft_version

0 comments on commit 9167a0e

Please sign in to comment.