Skip to content

Commit

Permalink
修改构建脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
Gu-ZT committed May 10, 2024
1 parent 4fbb81e commit b22204e
Show file tree
Hide file tree
Showing 5 changed files with 211 additions and 16 deletions.
104 changes: 89 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: Build Mod

on:
workflow_dispatch:
push:
branches: [ '1.20.x' ]
branches:
- fabric/**
paths:
- src/**
- build.gradle
Expand All @@ -11,23 +13,95 @@ on:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 17 ]
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}

steps:
- name: Check out
uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
- name: checkout
uses: actions/checkout@v3.1.0

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

- name: setup java ${{ matrix.java }}
uses: actions/setup-java@v3.6.0
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}

- name: Setup cache
uses: actions/cache@v3.0.11
with:
java-version: '17'
distribution: 'adopt'
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}

- name: make gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew

- name: Set build number
run: sed -i "s/undefined/$GITHUB_RUN_NUMBER/g" gradle.properties
- name: Grant execute permission
run: chmod +x gradlew
- name: Build with Gradle

- name: build
run: ./gradlew build
- name: Publish artifacts
uses: actions/upload-artifact@v2

- name: Find correct JAR
id: find-jar
run: |
output="$(find build/libs/ ! -name "*-dev.jar" ! -name "*-sources.jar" -type f -printf "%f\n")"
echo "jarname=$output" >> $GITHUB_OUTPUT
echo "jarname=$output"
- name: Get name
id: get-name
run: |
output="$(find build/libs/ ! -name "*-dev.jar" ! -name "*-sources.jar" -type f -printf "%f\n")"
output_without_extension="${output%.jar}"
echo "name=$output_without_extension" >> $GITHUB_OUTPUT
echo "name=$output_without_extension"
- name: Get Version
id: version
run: |
MESSAGE=$(ls build/libs/* | grep dev.jar -v | grep sources.jar -v | awk -F 'gugle-carpet-addition-mc1.20.1-|.jar' '{print $2}')
echo "version=$MESSAGE" >> $GITHUB_OUTPUT
echo "version=$MESSAGE"
- name: capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '17' }}
uses: actions/upload-artifact@v3.1.1
with:
name: ${{ steps.get-name.outputs.name }}
path: build/libs/${{ steps.find-jar.outputs.jarname }}

- name: publish mc mod
uses: Kir-Antipov/mc-publish@v3.3
continue-on-error: true
with:
name: Artifacts for ${{ github.sha }}
path: build/libs/
name: ${{ steps.get-name.outputs.name }}
version: ${{ steps.find-jar.outputs.jarname }}
game-versions: 1.20.1
version-type: release
java: 17
loaders: |
fabric
quilt
dependencies: |
fabric@0.83.0+1.20.1(required){modrinth:P7dR8mSH}{curseforge:306612}
carpet@1.4.112(required){modrinth:TQTTVgYE}{curseforge:349239}
fail-mode: skip

modrinth-id: UHjbX5mk
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
modrinth-featured: true

curseforge-id: 662867
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}

files: build/libs/${{ steps.find-jar.outputs.jarname }}
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Gugle's Carpet Addition [ English | [中文](README_cn.md) ]

[![Development Builds](https://github.com/Gu-ZT/gugle-carpet-addition/workflows/Build%20Mod/badge.svg)](https://github.com/Gu-ZT/gugle-carpet-addition/actions/workflows/ci.yml)
[![CurseForge downloads](http://cf.way2muchnoise.eu/full_662867_downloads.svg)](https://www.curseforge.com/minecraft/mc-mods/guglecarpetaddition)
[![Modrinth downloads](https://img.shields.io/modrinth/dt/gca?color=00AF5C&label=Modrinth%20downloads&logo=modrinth)](https://modrinth.com/mod/gca)
[![GitHub downloads](https://img.shields.io/github/downloads/Gu-ZT/gugle-carpet-addition/total?label=Github%20downloads&logo=github)](https://github.com/Gu-ZT/gugle-carpet-addition/releases)

![menu](docs/pics/menu_en.png)

## GCA

#### If you need GCA for Minecraft 1.13, [please click here](https://github.com/Gu-ZT/TISCarpet113WithGCA/releases/latest)

### openFakePlayerInventory

* Use `/carpet openFakePlayerInventory true` Allow player to open the fake player's inventory

![menu](docs/pics/inv.png)

### openFakePlayerEnderChest

* Use `/carpet openFakePlayerEnderChest true` Allow player to open the fake player's ender chest

Sneak to open the fake player's ender chest

![menu](docs/pics/ender.png)

### fakePlayerResident

* Use `/carpet fakePlayerResident true` to keep the fake player when exiting the level

### fakePlayerAutoReplenishment

* Use `/carpet fakePlayerAutoReplenishment true` to make fake player to auto replenishment

### fakePlayerAutoFish

* Use `/carpet fakePlayerAutoFish true` to make fake player to auto fish

### fakePlayerAutoReplaceTool

* Use `/carpet fakePlayerAutoReplaceTool true` to make fake player to auto replace tool

### betterFenceGatePlacement

* Use `/carpet betterFenceGatePlacement true` to make the placed fence gate have the same block status as the fence gate
you clicked

### betterWoodStrip

* Use `/carpet betterWoodStrip true` make only the axe with "Strip" in its name is allowed to peel logs

### betterSignInteraction

* Use `/carpet betterSignInteraction true` to make the block attached to the sign interact when you right-click it

### betterSignEditing

* Use `/carpet betterSignEditing true` to make it possible to use feather editing sign with "pen" in the name
57 changes: 57 additions & 0 deletions README_cn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Gugle的Carpet附加包 [ [English](README.md) | 中文 ]

[![Development Builds](https://github.com/Gu-ZT/gugle-carpet-addition/workflows/Build%20Mod/badge.svg)](https://github.com/Gu-ZT/gugle-carpet-addition/actions/workflows/ci.yml)
[![CurseForge downloads](http://cf.way2muchnoise.eu/full_662867_downloads.svg)](https://www.curseforge.com/minecraft/mc-mods/guglecarpetaddition)
[![Modrinth downloads](https://img.shields.io/modrinth/dt/gca?color=00AF5C&label=Modrinth%20downloads&logo=modrinth)](https://modrinth.com/mod/gca)
[![GitHub downloads](https://img.shields.io/github/downloads/Gu-ZT/gugle-carpet-addition/total?label=Github%20downloads&logo=github)](https://github.com/Gu-ZT/gugle-carpet-addition/releases)
![menu](docs/pics/menu_zh.png)

## GCA

#### 如果你需要Minecraft 1.13版本的GCA, [请点击此处](https://github.com/Gu-ZT/TISCarpet113WithGCA/releases/latest)

### 假人背包

* 使用 `/carpet openFakePlayerInventory true` 允许玩家打开假人背包

![menu](docs/pics/inv.png)

### 假人末影箱

* 使用 `/carpet openFakePlayerEnderChest true` 允许玩家打开假人末影箱

潜行可以打开假人的末影箱

![menu](docs/pics/ender.png)

### 假人驻留

* 使用 `/carpet fakePlayerResident true` 在退出存档时保留假人

### 假人补货

* 使用 `/carpet fakePlayerAutoReplenishment true` 让假人自动补货

### 假人钓鱼

* 使用 `/carpet fakePlayerAutoFish true` 让假人自动钓鱼

### 假人切换工具

* 使用 `/carpet fakePlayerAutoReplaceTool true` 让假人自动切换快损坏的工具

### 更好的栅栏门放置

* 使用 `/carpet betterFenceGatePlacement true` 让放置的栅栏门与你点击的栅栏门拥有相同的方块状态

### 更好的原木去皮

* 使用 `/carpet betterWoodStrip true` 使得仅允许名称中包含“去皮”的斧头对原木去皮

### 更好的告示牌交互

* 使用 `/carpet betterSignInteraction true` 使得右键告示牌时与之附着的方块产生交互

### 更好的告示牌编辑

* 使用 `/carpet betterSignEditing true` 使得允许使用名称中包含“笔”的羽毛编辑告示牌
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ plugins {
id 'maven-publish'
}

version = project.mod_version + "-" + project.minecraft_version
version = "mc" + project.minecraft_version + "-" + project.mod_version
group = project.maven_group

if (build_number != "undefined") {
version += "+build.${build_number}"
}

repositories {
// maven {
// name = 'ParchmentMC'
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ loader_version=0.14.21
# parchment_version=2022.08.14
# Mod Properties
mod_version=2.8.0
build_number=undefined
maven_group=dev.dubhe.gugle
archives_base_name=gugle-carpet-addition

Expand Down

0 comments on commit b22204e

Please sign in to comment.