From 0a0a34e84822bef078ab63f614c9a2e59db02cdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E4=BB=99xhcz?= Date: Sun, 16 Feb 2025 13:57:14 +0800 Subject: [PATCH 1/9] release.yml --- .github/workflows/Build.yml | 48 ----------------------------------- .github/workflows/release.yml | 31 ++++++++++++++++++++++ 2 files changed, 31 insertions(+), 48 deletions(-) delete mode 100644 .github/workflows/Build.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml deleted file mode 100644 index e36e948..0000000 --- a/.github/workflows/Build.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Release - -on: - push: - tags: - - 'v*' # 匹配以v开头的标签,例如v1.0.0 - -jobs: - build-and-release: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up JDK 21 - uses: actions/setup-java@v4 - with: - java-version: 21 - distribution: 'temurin' - cache: 'gradle' - - - name: Grant gradlew permission - run: chmod +x gradlew - - - name: Build with Gradle - run: ./gradlew build - - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref_name }} - draft: false - prerelease: false - - - name: Upload Release Asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: build/libs/*.jar - asset_name: ${{ github.ref_name }}.jar - asset_content_type: application/java-archive diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c8686c7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,31 @@ +name: Release Minecraft Mod + +on: + push: + tags: + - 'v*' # 只在推送 tag 时触发,tag 格式为 v1.0.0 等 + +jobs: + build: + runs-on: ubuntu-latest # 使用 Ubuntu 最新版本作为运行环境 + + steps: + - name: Checkout code + uses: actions/checkout@v2 # 检出代码 + + - name: Set up JDK 21 + uses: actions/setup-java@v3 + with: + java-version: '21' # 设置 Java 21 环境 + distribution: 'temurin' # 使用 Eclipse Temurin 发行版 + + - name: Build with Gradle + run: ./gradlew build # 使用 Gradle 编译 Mod + + - name: Upload to Release + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ github.event.release.upload_url }} # 从触发事件中获取上传 URL + asset_path: build/libs/*.jar # 上传构建的 jar 文件 + asset_name: MyMod-${{ github.ref_name }}.jar # 动态命名文件,例如 MyMod-v1.0.0.jar + asset_content_type: application/java-archive # 设置文件类型为 jar From 952bce5c42e88348a0386fe7d1110bc5cb1a71d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E4=BB=99xhcz?= Date: Sun, 16 Feb 2025 13:58:11 +0800 Subject: [PATCH 2/9] release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c8686c7..9337ac3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,5 +27,5 @@ jobs: with: upload_url: ${{ github.event.release.upload_url }} # 从触发事件中获取上传 URL asset_path: build/libs/*.jar # 上传构建的 jar 文件 - asset_name: MyMod-${{ github.ref_name }}.jar # 动态命名文件,例如 MyMod-v1.0.0.jar + asset_name: April-${{ github.ref_name }}.jar # 动态命名文件,例如 MyMod-v1.0.0.jar asset_content_type: application/java-archive # 设置文件类型为 jar From 92ea9d58c8099a5361107954fbaebd61a5c3e2a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E4=BB=99xhcz?= Date: Sun, 16 Feb 2025 14:12:57 +0800 Subject: [PATCH 3/9] release.yml --- .github/workflows/release.yml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9337ac3..c740806 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,29 +3,32 @@ name: Release Minecraft Mod on: push: tags: - - 'v*' # 只在推送 tag 时触发,tag 格式为 v1.0.0 等 + - 'v*' # 只在推送 tag 时触发 jobs: build: - runs-on: ubuntu-latest # 使用 Ubuntu 最新版本作为运行环境 + runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 # 检出代码 + uses: actions/checkout@v2 - name: Set up JDK 21 uses: actions/setup-java@v3 with: - java-version: '21' # 设置 Java 21 环境 - distribution: 'temurin' # 使用 Eclipse Temurin 发行版 + java-version: '21' + distribution: 'temurin' + + - name: Grant execute permission to gradlew + run: chmod +x gradlew # 确保 gradlew 可执行 - name: Build with Gradle - run: ./gradlew build # 使用 Gradle 编译 Mod + run: ./gradlew build # 使用正确的命令 - name: Upload to Release uses: actions/upload-release-asset@v1 with: - upload_url: ${{ github.event.release.upload_url }} # 从触发事件中获取上传 URL - asset_path: build/libs/*.jar # 上传构建的 jar 文件 - asset_name: April-${{ github.ref_name }}.jar # 动态命名文件,例如 MyMod-v1.0.0.jar - asset_content_type: application/java-archive # 设置文件类型为 jar + upload_url: ${{ github.event.release.upload_url }} + asset_path: build/libs/*.jar + asset_name: MyMod-${{ github.ref_name }}.jar + asset_content_type: application/java-archive \ No newline at end of file From df39e5da0f68ffb3adac04c9bd5dece466c05551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E4=BB=99xhcz?= Date: Sun, 16 Feb 2025 14:15:17 +0800 Subject: [PATCH 4/9] gradle wrapper --- gradlew => gradle wrapper | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename gradlew => gradle wrapper (100%) diff --git a/gradlew b/gradle wrapper similarity index 100% rename from gradlew rename to gradle wrapper From 8c5db0d3e11810e0de28d4068eba50958449db8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E4=BB=99xhcz?= Date: Sun, 16 Feb 2025 14:19:49 +0800 Subject: [PATCH 5/9] build.gradle --- build.gradle | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build.gradle b/build.gradle index dbaecd7..68e1e7b 100644 --- a/build.gradle +++ b/build.gradle @@ -1,3 +1,6 @@ +- name: Grant execute permission for gradlew + run: chmod +x gradlew + plugins { id 'java' } From 66111000161a904d7956a3f9ce077be75a049702 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E4=BB=99xhcz?= Date: Sun, 16 Feb 2025 14:22:29 +0800 Subject: [PATCH 6/9] build.gradle --- build.gradle | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/build.gradle b/build.gradle index 68e1e7b..9307b46 100644 --- a/build.gradle +++ b/build.gradle @@ -1,18 +1,9 @@ -- name: Grant execute permission for gradlew - run: chmod +x gradlew - plugins { id 'java' } group = 'cn.mcsfs' -version = '1.0-SNAPSHOT' - -def getVersionName = { - def tag = System.getenv("GITHUB_REF") ?: "v1.0.0" - tag = tag.replace("refs/tags/v", "").replace("refs/tags/", "") - return tag -} +version = '2025.1' version = getVersionName() @@ -61,5 +52,4 @@ processResources { tasks.withType(JavaCompile) { options.compilerArgs << "-Xlint:none" -} - +} \ No newline at end of file From 8824de0eaceb6f46d8601751649b2956aa3f03a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E4=BB=99xhcz?= Date: Sun, 16 Feb 2025 14:23:36 +0800 Subject: [PATCH 7/9] gradle --- gradle wrapper | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle wrapper b/gradle wrapper index f5feea6..b26d411 100644 --- a/gradle wrapper +++ b/gradle wrapper @@ -249,4 +249,4 @@ eval "set -- $( tr '\n' ' ' )" '"$@"' -exec "$JAVACMD" "$@" +exec "$JAVACMD" "$@" \ No newline at end of file From 0a1d0de80dc0676f612f82171cf1473464adcb6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E4=BB=99xhcz?= Date: Sun, 16 Feb 2025 14:36:59 +0800 Subject: [PATCH 8/9] --- .gitignore | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5e91f30 --- /dev/null +++ b/.gitignore @@ -0,0 +1,28 @@ +# gradle + +.gradle/ +build/ +out/ + +# idea + +.idea/* +!.idea/icon.svg +*.iml +*.ipr +*.iws + +# vscode + +.settings/ +.vscode/ +bin/ +.classpath +.project + +# fabric + +run/ +logs/ + +/changelog.txt \ No newline at end of file From d8124b18de015ac04ba8a8a17761d8ced5291a86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E4=BB=99xhcz?= Date: Sun, 16 Feb 2025 14:43:16 +0800 Subject: [PATCH 9/9] Update release.yml --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c740806..12b4b89 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,7 +28,7 @@ jobs: - name: Upload to Release uses: actions/upload-release-asset@v1 with: - upload_url: ${{ github.event.release.upload_url }} + upload_url: ${{ github.event.release.upload_url }} # 修正语法 asset_path: build/libs/*.jar asset_name: MyMod-${{ github.ref_name }}.jar - asset_content_type: application/java-archive \ No newline at end of file + asset_content_type: application/java-archive