forked from Hendrix-Shen/Bilibili-Danmaku
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0d7a8b9
commit bbde303
Showing
65 changed files
with
1,337 additions
and
610 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,162 +9,163 @@ on: | |
pull_request: | ||
jobs: | ||
build: | ||
if: ${{ github.event_name == 'push' }} | ||
if: ${{ github.event_name == 'push' && !startsWith(github.event.ref, 'refs/tags/') }} | ||
strategy: | ||
matrix: | ||
java: [17] | ||
os: [ubuntu-latest] | ||
java: [ 17 ] | ||
os: [ ubuntu-latest ] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout the sources | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK ${{ matrix.java }} | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: 'adopt' | ||
java-version: ${{ matrix.java }} | ||
|
||
- name: Cache Gradle packages | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | ||
restore-keys: ${{ runner.os }}-gradle | ||
|
||
- name: Get short commit sha | ||
id: get_short_sha | ||
run: | | ||
short_sha=$(echo ${GITHUB_SHA} | cut -c1-7) | ||
echo "::set-output name=short_sha::$short_sha" | ||
- name: Set build number in codes | ||
run: | | ||
sed -i "s/Development/Public Beta/g" src/main/java/top/hendrixshen/bilibilidanmaku/BilibiliDanmakuReference.java | ||
- name: Read relevant fields from gradle.properties | ||
id: properties | ||
run: | | ||
path='./gradle.properties' | ||
for property in mod_name mod_version minecraft_version_out | ||
do | ||
result=$(sed -n "/^[[:space:]]*$property[[:space:]]*=[[:space:]]*/s/^[[:space:]]*$property[[:space:]]*=[[:space:]]*//p" "$path") | ||
echo "$property: $result" | ||
echo ::set-output name=$property::"$result" | ||
done | ||
- name: Read Properties mod_name | ||
id: mod_name | ||
uses: christian-draeger/[email protected] | ||
with: | ||
path: gradle.properties | ||
property: mod_name | ||
|
||
- name: Read Properties mod_version | ||
id: mod_version | ||
uses: christian-draeger/[email protected] | ||
with: | ||
path: gradle.properties | ||
property: mod_version | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Build with Gradle | ||
env: | ||
GIT_COMMIT_ID: ${{ steps.get_short_sha.outputs.short_sha }} | ||
COMMIT_SHA: ${{ steps.get_short_sha.outputs.short_sha }} | ||
BUILD_TYPE: "BETA" | ||
BUILD_NUMBER: ${{ github.run_number}} | ||
run: ./gradlew build | ||
|
||
- name: Upload assets to GitHub Action | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ steps.mod_name.outputs.value }} ${{ steps.mod_version.outputs.value }}.${{ github.run_number}}+${{ steps.get_short_sha.outputs.short_sha }} | ||
path: build/libs/ | ||
|
||
- name: Create Github release | ||
uses: marvinpinto/[email protected] | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
automatic_release_tag: "CI/build.${{ github.run_number}}" | ||
prerelease: true | ||
title: "[CI#${{ github.run_number}}]${{ steps.properties.outputs.mod_name }} ${{ steps.properties.outputs.mod_version }}(${{ steps.get_short_sha.outputs.short_sha }}) for Minecraft ${{ steps.properties.outputs.minecraft_version_out }}" | ||
title: "[CI#${{ github.run_number}}]${{ steps.mod_name.outputs.value }} ${{ steps.mod_version.outputs.value }}.${{ github.run_number}}+${{ steps.get_short_sha.outputs.short_sha }}" | ||
files: | | ||
LICENSE | ||
build/libs/*.jar | ||
publish: | ||
if: ${{ github.event_name == 'release' }} | ||
strategy: | ||
matrix: | ||
java: [17] | ||
os: [ubuntu-latest] | ||
branch: [1.15, 1.16, 1.17, 1.18, 1.19] | ||
java: [ 17 ] | ||
os: [ ubuntu-latest ] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout the sources | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ matrix.branch }} | ||
|
||
- name: Set up JDK ${{ matrix.java }} | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: 'adopt' | ||
java-version: ${{ matrix.java }} | ||
|
||
- name: Cache Gradle packages | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | ||
restore-keys: ${{ runner.os }}-gradle | ||
- name: Get commit sha from the corresponding branch | ||
id: get_sha | ||
uses: mego22/actions-git-sha@main | ||
with: | ||
repo: "https://github.com/Hendrix-Shen/Bilibili-Danmaku" | ||
branch: "${{ matrix.branch }}" | ||
|
||
- name: Get short commit sha | ||
id: get_short_sha | ||
run: | | ||
short_sha=$(echo ${{ steps.get_sha.outputs.sha }} | cut -c1-7) | ||
short_sha=$(echo ${GITHUB_SHA} | cut -c1-7) | ||
echo "::set-output name=short_sha::$short_sha" | ||
- name: Set build number in codes | ||
run: | | ||
sed -i "s/Development/Public Beta/g" src/main/java/top/hendrixshen/bilibilidanmaku/BilibiliDanmakuReference.java | ||
- name: Read relevant fields from gradle.properties | ||
id: properties | ||
run: | | ||
path='./gradle.properties' | ||
for property in mod_file_name mod_version minecraft_version_out cruseforge_gameversion cruseforge_projectid cruseforge_relations cruseforge_release cruseforge_release_type github_release modrinth_release modrinth_release_type | ||
do | ||
result=$(sed -n "/^[[:space:]]*$property[[:space:]]*=[[:space:]]*/s/^[[:space:]]*$property[[:space:]]*=[[:space:]]*//p" "$path") | ||
echo "$property: $result" | ||
echo ::set-output name=$property::"$result" | ||
done | ||
- name: Read Properties mod_name | ||
id: mod_name | ||
uses: christian-draeger/[email protected] | ||
with: | ||
path: gradle.properties | ||
property: mod_name | ||
|
||
- name: Read Properties mod_version | ||
id: mod_version | ||
uses: christian-draeger/[email protected] | ||
with: | ||
path: gradle.properties | ||
property: mod_version | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Build with Gradle | ||
env: | ||
GIT_COMMIT_ID: ${{ steps.get_short_sha.outputs.short_sha }} | ||
COMMIT_SHA: ${{ steps.get_short_sha.outputs.short_sha }} | ||
BUILD_TYPE: "RELEASE" | ||
BUILD_NUMBER: ${{ github.run_number}} | ||
run: ./gradlew build | ||
- name: Find correct jar | ||
id: findjar | ||
run: | | ||
output="$(find build/libs/ ! -name "*-dev.jar" ! -name "*-sources.jar" -type f -printf "%f\n")" | ||
echo "::set-output name=jarname::$output" | ||
|
||
- name: Upload assets to GitHub Action | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ steps.mod_name.outputs.value }} ${{ steps.mod_version.outputs.value }}.${{ github.run_number}}+${{ steps.get_short_sha.outputs.short_sha }} | ||
path: build/libs/ | ||
|
||
- name: Upload assets to GitHub Release | ||
if: ${{ steps.properties.outputs.github_release == 'true' }} | ||
uses: AButler/[email protected] | ||
with: | ||
files: 'build/libs/${{ steps.findjar.outputs.jarname }}' | ||
files: 'build/libs/*' | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Upload assets to Curseforge | ||
if: ${{ steps.properties.outputs.cruseforge_release == 'true' }} | ||
uses: itsmeow/curseforge-upload@v3 | ||
with: | ||
token: ${{ secrets.CF_API_TOKEN }} | ||
project_id: ${{ steps.properties.outputs.cruseforge_projectid }} | ||
game_endpoint: minecraft | ||
file_path: build/libs/${{ steps.findjar.outputs.jarname }} | ||
changelog_type: markdown | ||
changelog: ${{ github.event.release.body }} | ||
game_versions: ${{ steps.properties.outputs.cruseforge_gameversion }} | ||
release_type: ${{ steps.properties.outputs.cruseforge_release_type }} | ||
relations: ${{ steps.properties.outputs.cruseforge_relations }} | ||
- name: Upload assets to Modrinth | ||
if: ${{ steps.properties.outputs.modrinth_release == 'true' }} | ||
run: ./gradlew publishModrinth | ||
env: | ||
CHANGE_LOG: ${{ github.event.release.body }} | ||
GIT_COMMIT_ID: ${{ steps.get_short_sha.outputs.short_sha }} | ||
MODRINTH_API_TOKEN: ${{ secrets.MODRINTH_API_TOKEN }} | ||
VERSION_NUMBER: ${{ steps.properties.outputs.mod_file_name }}-mc${{ steps.properties.outputs.minecraft_version_out }}-${{ steps.properties.outputs.mod_version }}+${{ steps.get_short_sha.outputs.short_sha }} | ||
|
||
pull_request: | ||
if: ${{ github.event_name == 'pull_request' }} | ||
strategy: | ||
matrix: | ||
java: [17] | ||
os: [ubuntu-latest] | ||
java: [ 17 ] | ||
os: [ ubuntu-latest ] | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Checkout the sources | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK ${{ matrix.java }} | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: 'adopt' | ||
java-version: ${{ matrix.java }} | ||
|
||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
dependencies { | ||
minecraft("com.mojang:minecraft:${project.minecraft_version}") | ||
|
||
modImplementation("curse.maven:malilib-303119:${project.library_malilib_version}") | ||
modImplementation("curse.maven:modmenu-308702:${project.library_modmenu_version}") | ||
|
||
modRuntimeOnly("curse.maven:in-game-account-switcher-232676:${project.library_inGameAccountSwitcher_version}") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Mod reference | ||
mod_id = bilibili-danmaku-compat-mc1_14 | ||
|
||
# Development Environment | ||
minecraft_version = 1.14.4 | ||
|
||
# Require Libraries | ||
# MaLiLib - 0.10.0-dev.20+arne.2 | ||
library_malilib_version = 2876325 | ||
# Mod Menu - 1.7.17 | ||
library_modmenu_version = 3121565 | ||
|
||
# Runtime Libraries | ||
# In-Game Account Switcher - 7.1.3 | ||
library_inGameAccountSwitcher_version = 3493805 |
12 changes: 12 additions & 0 deletions
12
...ku-compat-mc1_14/src/main/java/top/hendrixshen/bilibilidanmaku/BilibiliDanmakuCompat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package top.hendrixshen.bilibilidanmaku; | ||
|
||
import net.fabricmc.api.ModInitializer; | ||
|
||
public class BilibiliDanmakuCompat implements ModInitializer { | ||
@Override | ||
public void onInitialize() { | ||
BilibiliDanmaku.getLogger().info("[{}]: Compat module for {} loaded. Starting compat api...", BilibiliDanmakuCompatReference.getModName(), BilibiliDanmakuCompatReference.getCompatVersion()); | ||
|
||
BilibiliDanmaku.getLogger().info("[{}]: Compat initialized - Version: {} ({})", BilibiliDanmakuCompatReference.getModName(), BilibiliDanmakuCompatReference.getModVersion(), BilibiliDanmakuCompatReference.getModVersionType()); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...-mc1_14/src/main/java/top/hendrixshen/bilibilidanmaku/BilibiliDanmakuCompatReference.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package top.hendrixshen.bilibilidanmaku; | ||
|
||
import net.fabricmc.loader.api.FabricLoader; | ||
import top.hendrixshen.bilibilidanmaku.util.VersionParser; | ||
|
||
public class BilibiliDanmakuCompatReference { | ||
private static final String MOD_COMPAT_VERSION = "MC 1.14.x"; | ||
private static final String MOD_ID = "bilibili-danmaku-compat-mc1_14"; | ||
private static final String MOD_NAME = FabricLoader.getInstance().getModContainer(MOD_ID).orElseThrow(RuntimeException::new).getMetadata().getName(); | ||
private static final String MOD_VERSION = FabricLoader.getInstance().getModContainer(MOD_ID).orElseThrow(RuntimeException::new).getMetadata().getVersion().getFriendlyString(); | ||
private static final String MOD_VERSION_TYPE = VersionParser.getVersionType(MOD_VERSION); | ||
|
||
public static String getCompatVersion() { | ||
return MOD_COMPAT_VERSION; | ||
} | ||
|
||
public static String getModId() { | ||
return MOD_ID; | ||
} | ||
|
||
public static String getModName() { | ||
return MOD_NAME; | ||
} | ||
|
||
public static String getModVersion() { | ||
return MOD_VERSION; | ||
} | ||
|
||
public static String getModVersionType() { | ||
return MOD_VERSION_TYPE; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...t-mc1_14/src/main/java/top/hendrixshen/bilibilidanmaku/compat/modmenu/ModMenuApiImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package top.hendrixshen.bilibilidanmaku.compat.modmenu; | ||
|
||
import io.github.prospector.modmenu.api.ModMenuApi; | ||
import net.minecraft.client.gui.screens.Screen; | ||
import top.hendrixshen.bilibilidanmaku.BilibiliDanmakuConfigGui; | ||
import top.hendrixshen.bilibilidanmaku.BilibiliDanmakuReference; | ||
|
||
import java.util.function.Function; | ||
|
||
public class ModMenuApiImpl implements ModMenuApi { | ||
@Override | ||
public String getModId() { | ||
return BilibiliDanmakuReference.getModId(); | ||
} | ||
|
||
@Override | ||
public Function<Screen, ? extends Screen> getConfigScreenFactory() { | ||
return (screen) -> { | ||
BilibiliDanmakuConfigGui gui = BilibiliDanmakuConfigGui.getInstance(); | ||
gui.setParent(screen); | ||
return gui; | ||
}; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
bilibili-danmaku-compat-mc1_14/src/main/resources/bilibili-danmaku-compat.mixins.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"required": true, | ||
"package": "top.hendrixshen.bilibilidanmaku.compat.mixin", | ||
"plugin": "top.hendrixshen.bilibilidanmaku.BilibiliDanmakuMixinPlugin", | ||
"minVersion": "0.8", | ||
"compatibilityLevel": "JAVA_8", | ||
"client": [ | ||
], | ||
"mixins": [ | ||
], | ||
"injectors": { | ||
"defaultRequire": 0 | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
bilibili-danmaku-compat-mc1_14/src/main/resources/fabric.mod.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"schemaVersion": 1, | ||
"id": "bilibili-danmaku-compat-mc1_14", | ||
"name": "Bilibili Danmaku Compat", | ||
"version": "${mod_version}", | ||
"description": "Bilibili Danmaku compat for Minecraft 1.14.x", | ||
"authors": [ | ||
{ | ||
"name": "Hendrix_Shen", | ||
"contact": { | ||
"homepage": "https://github.com/Hendrix-Shen" | ||
} | ||
} | ||
], | ||
"contact": { | ||
"homepage": "https://github.com/Hendrix-Shen/Bilibili-Danmaku", | ||
"issues": "https://github.com/Hendrix-Shen/Bilibili-Danmaku/issues", | ||
"sources": "https://github.com/Hendrix-Shen/Bilibili-Danmaku" | ||
}, | ||
"license": "GPLv3", | ||
"environment": "client", | ||
"entrypoints": { | ||
"main": [ | ||
"top.hendrixshen.bilibilidanmaku.BilibiliDanmakuCompat" | ||
] | ||
}, | ||
"mixins": [ | ||
"bilibili-danmaku-compat.mixins.json" | ||
], | ||
"depends": { | ||
"minecraft": "1.14.x", | ||
"bilibili-danmaku": "*" | ||
}, | ||
"custom": { | ||
"modmenu:parent": "bilibili-danmaku", | ||
"modmenu:clientsideOnly": true, | ||
"modmenu": { | ||
"parent": "bilibili-danmaku" | ||
} | ||
} | ||
} |
Oops, something went wrong.