Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
*.bat text eol=crlf
*.patch text eol=lf
*.java text eol=lf
*.gradle text eol=crlf
*.gradle text eol=lf
*.png binary
*.gif binary
*.exe binary
Expand Down
20 changes: 18 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- reopened
push:
workflow_dispatch:
workflow_call:

jobs:
build:
Expand All @@ -17,19 +18,34 @@ jobs:
- name: Checkout repository
uses: neoforged/actions/checkout@main

- name: Setup JDK 21
- name: Setup JDK 25
uses: neoforged/actions/setup-java@main
with:
java-version: 21
java-version: 25

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
env:
# Gradle by default prioritizes same job id and same workflow over same commit
GRADLE_BUILD_ACTION_CACHE_KEY_JOB_INSTANCE: build
with:
cache-read-only: false

- name: Setup
run: ./gradlew :createPatchWorkspace

- name: Test
run: ./gradlew :check

- name: Create build
run: ./gradlew :createDataArchive

- name: Upload build
uses: actions/upload-artifact@v7
with:
path: build/libs/neoform-*.zip
archive: false

- name: Publish PR artifacts
if: ${{ github.event_name == 'pull_request' }}
uses: neoforged/action-pr-publishing/upload@v1
21 changes: 8 additions & 13 deletions .github/workflows/check-for-updates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Java 21
uses: neoforged/actions/setup-java@main
with:
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
# This job will create outputs:
# - release_type ('special' for anything that's not mainline)
# - latest_version
# - current_version
- id: check_for_update
name: Check for Minecraft Updates
run: ./gradlew :checkForMinecraftUpdate
- name: Check for Minecraft Updates
id: check_for_update
run: |
LATEST_SNAPSHOT=$(wget -O - https://piston-meta.mojang.com/mc/game/version_manifest_v2.json | jq -r '.latest.snapshot as $latest_snapshot | .versions[] | select(.id == $latest_snapshot)')
echo "release_type=$(jq -r 'if .type == "release" then "release" elif .id | test("^\\d+\\.\\d+(\\.\\d+)?-(snapshot|pre|rc)-\\d+$") then "snapshot" else "special" end' <<< $LATEST_SNAPSHOT)" >> $GITHUB_OUTPUT
echo "latest_version=$(jq -r .id <<< $LATEST_SNAPSHOT)" >> $GITHUB_OUTPUT
# https://stackoverflow.com/questions/35475432/read-versionname-from-build-gradle-in-bash
echo "current_version=$(grep "minecraftVersion" settings.gradle | awk '{print $3}' | tr -d "\'\r")" >> $GITHUB_OUTPUT
- id: postprocess
name: Post-Process Update Variables
uses: actions/github-script@v8
Expand Down
33 changes: 23 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ env:
ORG_GRADLE_PROJECT_neoform_release: ${{ inputs.release }}

jobs:
publish:
name: ${{ inputs.release && 'Publish Release' || 'Publish Snapshot' }}
setup:
name: Setup publish
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get-version.outputs.version }}
version: ${{ steps.get-version.outputs.version}}
steps:
- uses: actions/checkout@v4

- name: Setup Java
uses: neoforged/actions/setup-java@main
with:
java-version: 21
java-version: 25

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
Expand All @@ -56,10 +56,23 @@ jobs:
state: 'pending'
description: "Version: ${{ steps.get-version.outputs.version }}"
target_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
check:
uses: ./.github/workflows/build.yml
publish:
name: ${{ inputs.release && 'Publish Release' || 'Publish Snapshot' }}
runs-on: ubuntu-latest
needs: ["setup", "check"]
steps:
- uses: actions/checkout@v4

- name: Tests
run: ./gradlew check
- name: Setup Java
uses: neoforged/actions/setup-java@main
with:
java-version: 25

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Tag Release
if: ${{ inputs.release }}
run: |
Expand All @@ -82,8 +95,8 @@ jobs:
echo "Tag $TAG_NAME exists, but correctly points to current HEAD"
fi
env:
VERSION: ${{ steps.get-version.outputs.version }}
TAG_NAME: v${{ steps.get-version.outputs.version }}
VERSION: ${{ needs.setup.outputs.version }}
TAG_NAME: v${{ needs.setup.outputs.version }}

- name: Publish
run: ./gradlew publish
Expand All @@ -102,7 +115,7 @@ jobs:
with:
webhook_url: ${{ secrets.DISCORD_WEBHOOK }}
status: ${{ needs.publish.result }}
version: ${{ needs.publish.outputs.version }}
version: ${{ needs.setup.outputs.version }}
include_commit_message: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -112,5 +125,5 @@ jobs:
authToken: ${{ secrets.GITHUB_TOKEN }}
context: 'Publishing'
state: ${{ needs.publish.result }}
description: "Version: ${{ needs.publish.outputs.version }}"
description: "Version: ${{ needs.setup.outputs.version }}"
target_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
12 changes: 7 additions & 5 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ jobs:
NEW_VERSION: ${{ inputs.new_version }}
steps:
- uses: actions/checkout@v4
- name: Setup Java 21
- name: Setup Java 25
uses: neoforged/actions/setup-java@main
with:
java-version: 21
java-version: 25
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Create new Branch
Expand All @@ -75,7 +75,9 @@ jobs:
if: ${{ inputs.new_version }}
run: ./gradlew -- updateMinecraft "--version=$NEW_VERSION"
- name: Update Patches
run: ./gradlew createPatchWorkspaceForUpdate && ./gradlew createPatches
id: update-patches
continue-on-error: true
run: ./gradlew createPatchWorkspace && ./gradlew createPatches
- name: Commit Changes
# See https://github.com/actions/checkout?tab=readme-ov-file#push-a-commit-using-the-built-in-token
id: commit-changes
Expand All @@ -90,12 +92,12 @@ jobs:
echo "changed=true" >> $GITHUB_OUTPUT
fi
env:
COMMIT_MESSAGE: ${{ inputs.new_version && format('Update to {0}', inputs.new_version) || (inputs.update_tools && 'Update Tools' || 'Update') }}
COMMIT_MESSAGE: ${{ format('{0}{1}', case(steps.update-patches.outcome == 'failure', 'Start update', 'Update'), case(inputs.new_version != null, format(' to {0}', inputs.new_version), inputs.update_tools, ' Tools', '')) }}
- name: Push Changes
if: steps.commit-changes.outputs.changed
run: git push -u origin HEAD
- name: Trigger Publish Workflow
if: inputs.publish && steps.commit-changes.outputs.changed
if: inputs.publish && steps.commit-changes.outputs.changed && steps.update-patches.outcome == 'success'
uses: actions/github-script@v8
# We need to use environment variables here to avoid untrusted input injection into the javascript code below.
env:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/.idea
/.gradle
/**/build
/workspace
/workspace/*/*
!/workspace/*/build.gradle
/plugin/.gradle

# Eclipse Files
Expand Down
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ have a corresponding tag as well.
A typical workflow to change the patches would be:

- Run `gradlew :createPatchWorkspace` in the root, when the patches are already correct for the targeted Minecraft
version,
or `gradlew :createPatchWorkspaceForUpdate` for performing an update.
- Reload the gradle project in your IDE, there will now be a subproject at `/workspace` containing the patched Minecraft
version.
- Reload the gradle project in your IDE, there will now be subprojects in `/workspace` containing the patched Minecraft
code.
- Make any desired changes to the source code
- Run `gradlew :createPatches` to create new patch files from the sources currently contained in the workspace.
Expand All @@ -26,8 +25,7 @@ A typical workflow to change the patches would be:
| Task | Description |
|----------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `:createPatchWorkspace` | Decompile Minecraft, apply patches from `src/patches` and place the code in `workspace`. |
| `:createPatchWorkspaceForUpdate` | Same as `:createPatchWorkspace`, but patches will be applied partially and rejects stored in the `rejects` folder. Used to update to a new Minecraft version. |
| `:workspace:runClient` | Runs the client in the workspace subproject. |
| `:<distribution>:runClient` | Runs the client in the <distribution> subproject. |
| `:check` | Runs the data contained in the current branch through [NeoFormRuntime](https://github.com/neoforged/NeoFormRuntime/), as well as the Eclipse Compiler. |

## GitHub Actions Workflows
Expand Down
Loading