From 69ed7407521250b947c933cdc4cc6d75f09021b7 Mon Sep 17 00:00:00 2001 From: Gate Guardian Date: Mon, 2 Feb 2026 23:23:16 +0800 Subject: [PATCH 1/7] ci: Added GitHub Actions build workflow --- .github/workflows/build.yml | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..711bc23 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,38 @@ +name: Build + +on: + push: + branches: [ "1.20.1", "workflow" ] + pull_request: + branches: [ "1.20.1", "workflow" ] + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Set up JDK 17 + uses: actions/setup-java@v5 + with: + java-version: '17' + distribution: 'temurin' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build with Gradle + run: ./gradlew build + + - name: Upload build artifacts + uses: actions/upload-artifact@v6 + with: + name: mod-jar + path: build/libs/*.jar + retention-days: 7 From 0454570d948bca496dde7f3bc21af7719d5ae81d Mon Sep 17 00:00:00 2001 From: Gate Guardian Date: Tue, 3 Feb 2026 01:00:18 +0800 Subject: [PATCH 2/7] ci: Refactored build workflow with custom setup action --- .github/actions/setup/action.yml | 36 +++++++++++++++++++++++ .github/workflows/build.yml | 50 +++++++++++++++++++------------- 2 files changed, 66 insertions(+), 20 deletions(-) create mode 100644 .github/actions/setup/action.yml diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 0000000..3fea98e --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,36 @@ +name: Setup Environment +description: Setup JDK and Gradle + +inputs: + update-cache: + description: If cache should be updated + required: false + default: 'false' + ref: + description: Ref to checkout + required: false + +runs: + using: composite + steps: + - name: Checkout Repository + uses: actions/checkout@v6 + with: + ref: ${{ inputs.ref || github.ref }} + + - name: Setup JDK + uses: actions/setup-java@v5 + with: + java-version: 17 + distribution: temurin + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + with: + cache-write-only: ${{ inputs.update-cache }} + cache-read-only: ${{ github.ref != 'refs/heads/1.20.1' }} + add-job-summary: on-failure + + - name: Grant Execute Permission for gradlew + shell: bash + run: chmod +x gradlew \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 711bc23..c4007f4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,36 +3,46 @@ name: Build on: push: branches: [ "1.20.1", "workflow" ] + paths: + - 'src/**' + - '**/*.gradle' + - '**/*.gradle.kts' + - 'gradle.properties' + - 'gradle/**' pull_request: branches: [ "1.20.1", "workflow" ] - workflow_dispatch: + +concurrency: + group: build-${{ github.ref }} + cancel-in-progress: true jobs: build: runs-on: ubuntu-latest - + permissions: + contents: read + env: + CI: true steps: - - name: Checkout repository - uses: actions/checkout@v6 - - - name: Set up JDK 17 - uses: actions/setup-java@v5 - with: - java-version: '17' - distribution: 'temurin' - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@v4 - - - name: Grant execute permission for gradlew - run: chmod +x gradlew + - name: Setup Environment + uses: ./.github/actions/setup - name: Build with Gradle - run: ./gradlew build - - - name: Upload build artifacts + run: gradlew build --no-daemon + + - name: Get Mod Information + id: info + run: | + MOD_VERSION=$(grep -oP 'mod_version=\K.*' gradle.properties) + MC_VERSION=$(grep -oP 'minecraft_version=\K.*' gradle.properties) + echo "mod_version=$MOD_VERSION" >> $GITHUB_OUTPUT + echo "mc_version=$MC_VERSION" >> $GITHUB_OUTPUT + echo "sha_short=$(echo '${{ github.sha }}' | cut -c 1-7)" >> $GITHUB_OUTPUT + + - name: Upload Artifacts uses: actions/upload-artifact@v6 with: - name: mod-jar + name: hoarding-${{ steps.version.outputs.mc_version }}-${{ steps.version.outputs.mod_version }}+${{ steps.suffix.outputs.sha_short }} path: build/libs/*.jar + if-no-files-found: error retention-days: 7 From 99265a852a07ee630af0ac0a462a795d0d0c91d7 Mon Sep 17 00:00:00 2001 From: Gate Guardian Date: Tue, 3 Feb 2026 01:04:37 +0800 Subject: [PATCH 3/7] ci: Expanded build workflow trigger paths --- .github/workflows/build.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c4007f4..a7470be 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,10 +5,11 @@ on: branches: [ "1.20.1", "workflow" ] paths: - 'src/**' - - '**/*.gradle' - - '**/*.gradle.kts' - - 'gradle.properties' - 'gradle/**' + - '**/*.gradle.kts' + - '**/gradle.properties' + - '.github/workflows/**' + - '.github/actions/**' pull_request: branches: [ "1.20.1", "workflow" ] From e627f9a2e9baf84fceb9be3ecf0f9e05580d766d Mon Sep 17 00:00:00 2001 From: Gate Guardian Date: Tue, 3 Feb 2026 01:08:44 +0800 Subject: [PATCH 4/7] ci: Moved checkout step from setup action to build --- .github/actions/setup/action.yml | 8 -------- .github/workflows/build.yml | 3 +++ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 3fea98e..5d0a8d6 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -6,18 +6,10 @@ inputs: description: If cache should be updated required: false default: 'false' - ref: - description: Ref to checkout - required: false runs: using: composite steps: - - name: Checkout Repository - uses: actions/checkout@v6 - with: - ref: ${{ inputs.ref || github.ref }} - - name: Setup JDK uses: actions/setup-java@v5 with: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a7470be..8a0b2e4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,6 +25,9 @@ jobs: env: CI: true steps: + - name: Checkout Repository + uses: actions/checkout@v6 + - name: Setup Environment uses: ./.github/actions/setup From 806729fe007ab5fe37f7cb9b4861db3e6bc13ec9 Mon Sep 17 00:00:00 2001 From: Gate Guardian Date: Tue, 3 Feb 2026 01:11:03 +0800 Subject: [PATCH 5/7] ci: Fixed gradlew path in build workflow --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8a0b2e4..9d7040c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,7 +32,7 @@ jobs: uses: ./.github/actions/setup - name: Build with Gradle - run: gradlew build --no-daemon + run: ./gradlew build --no-daemon - name: Get Mod Information id: info From 01d53f6bf560fd34a0af0017403ce7564853a8ca Mon Sep 17 00:00:00 2001 From: Gate Guardian Date: Tue, 3 Feb 2026 01:17:41 +0800 Subject: [PATCH 6/7] ci: Updated artifact name step references --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9d7040c..82c12d4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -46,7 +46,7 @@ jobs: - name: Upload Artifacts uses: actions/upload-artifact@v6 with: - name: hoarding-${{ steps.version.outputs.mc_version }}-${{ steps.version.outputs.mod_version }}+${{ steps.suffix.outputs.sha_short }} + name: hoarding-${{ steps.info.outputs.mc_version }}-${{ steps.info.outputs.mod_version }}+${{ steps.info.outputs.sha_short }} path: build/libs/*.jar if-no-files-found: error retention-days: 7 From f2b4da99158cb8fdc9682ea93046a795cd15566c Mon Sep 17 00:00:00 2001 From: Gate Guardian Date: Tue, 3 Feb 2026 01:54:02 +0800 Subject: [PATCH 7/7] ci: Removed workflow branch from build triggers --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 82c12d4..6b96f30 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,7 @@ name: Build on: push: - branches: [ "1.20.1", "workflow" ] + branches: [ "1.20.1" ] paths: - 'src/**' - 'gradle/**' @@ -11,7 +11,7 @@ on: - '.github/workflows/**' - '.github/actions/**' pull_request: - branches: [ "1.20.1", "workflow" ] + branches: [ "1.20.1" ] concurrency: group: build-${{ github.ref }}