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 b8d2f4f commit c707b6f
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 128 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: CI for Mod
on:
workflow_dispatch:
push:
branches:
- releases/**
Expand All @@ -13,9 +14,6 @@ on:
- settings.gradle

jobs:
gametest:
secrets: inherit
uses: ./.github/workflows/gametest.yml
build:
runs-on: ubuntu-latest
env:
Expand Down Expand Up @@ -73,3 +71,15 @@ jobs:
MAVEN_USERNAME: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASS }}
continue-on-error: true

- name: Fabric Game Test
uses: Anvil-Dev/dedicated-server-launch-test@1.20.1-fabric
with:
mod: fabric/build/libs/${{ steps.properties.outputs.mod_id }}-fabric-${{ steps.version.outputs.version }}.jar
extra-mods: fabric-api:0.92.2+1.20.1 patchouli:1.20.1-84-fabric cloth-config:11.1.136+fabric

- name: Forge Game Test
uses: Anvil-Dev/dedicated-server-launch-test@1.20.1-forge
with:
mod: forge/build/libs/${{ steps.properties.outputs.mod_id }}-forge-${{ steps.version.outputs.version }}.jar
extra-mods: patchouli:1.20.1-84-forge cloth-config:11.1.136+forge
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.

20 changes: 16 additions & 4 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 @@ -63,3 +63,15 @@ jobs:
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: Fabric Game Test
uses: Anvil-Dev/dedicated-server-launch-test@1.20.1-fabric
with:
mod: fabric/build/libs/${{ steps.properties.outputs.mod_id }}-fabric-${{ steps.version.outputs.version }}.jar
extra-mods: fabric-api:0.92.2+1.20.1 patchouli:1.20.1-84-fabric cloth-config:11.1.136+fabric

- name: Forge Game Test
uses: Anvil-Dev/dedicated-server-launch-test@1.20.1-forge
with:
mod: forge/build/libs/${{ steps.properties.outputs.mod_id }}-forge-${{ steps.version.outputs.version }}.jar
extra-mods: patchouli:1.20.1-84-forge cloth-config:11.1.136+forge
27 changes: 14 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
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
Expand Down Expand Up @@ -56,6 +57,14 @@ jobs:
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: Publish to maven
run: ./gradlew publish
env:
MAVEN_URL: ${{ secrets.MAVEN_URL }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASS }}
continue-on-error: true

- name: Upload Release Jar
uses: softprops/action-gh-release@v0.1.15
with:
Expand All @@ -64,14 +73,6 @@ jobs:
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: Publish to maven
run: ./gradlew publish
env:
MAVEN_URL: ${{ secrets.MAVEN_URL }}
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
Expand All @@ -84,11 +85,11 @@ jobs:
# 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: |
Expand All @@ -108,11 +109,11 @@ jobs:
# 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: |
Expand Down
13 changes: 13 additions & 0 deletions common/src/main/java/dev/anvilcraft/lib/AnvilLib.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

import dev.anvilcraft.lib.util.Platform;
import dev.architectury.injectables.annotations.ExpectPlatform;
import net.minecraft.resources.ResourceLocation;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -15,6 +18,16 @@ public static void init() {

}

public static @NotNull ResourceLocation of(@NotNull String path) {
String namespace = MOD_ID;
if (path.contains(":")) {
namespace = path.split(":")[0];
path = path.split(":")[1];
}
return new ResourceLocation(namespace, path);
}

@SuppressWarnings("unused")
@ExpectPlatform
public static Platform getPlatform() {
throw new AssertionError();
Expand Down

0 comments on commit c707b6f

Please sign in to comment.