Skip to content

Use an in-tree Gradle plugin instead of an external Gradle Plugin to make version-specific changes easier #4196

Use an in-tree Gradle plugin instead of an external Gradle Plugin to make version-specific changes easier

Use an in-tree Gradle plugin instead of an external Gradle Plugin to make version-specific changes easier #4196

Workflow file for this run

# File generated by the GradleUtils `setupGitHubActionsWorkflows` task, avoid modifying it directly
# The template can be found at https://github.com/neoforged/GradleUtils/blob/44d9e09cfa2c6032b84ac40495ea5ab7d64fe521/src/actionsTemplate/resources/.github/workflows/build-prs.yml
name: Build PRs
on:
pull_request:
types:
- synchronize
- opened
- ready_for_review
- reopened
push:
branches:
- 'feature/**'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1000
fetch-tags: true
# GradleUtils will append the branch name to the version,
# but for that we need a properly checked out branch
- name: Create branch for commit (PR)
if: ${{ github.event_name == 'pull_request' }}
run:
git switch -C pr-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.ref }}
- name: Create branch for commit
if: ${{ github.event_name != 'pull_request' }}
run:
git switch -C ${{ github.ref_name }}
- name: Setup JDK 21
uses: neoforged/actions/setup-java@main
with:
java-version: 21
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-read-only: false
- name: Setup with Gradle
run: ./gradlew :neoforge:setup -PvalidateAccessTransformers
- name: Build with Gradle
run: ./gradlew assemble checkFormatting
- name: Run JCC
if: ${{ ! startsWith(github.event.pull_request.head.ref, 'port/') && ! startsWith(github.ref_name, 'port/') && ! startsWith(github.event.pull_request.base.ref, 'port/') }}
run: ./gradlew checkJarCompatibility
- name: Upload JCC
if: ${{ ! startsWith(github.event.pull_request.head.ref, 'port/') && ! startsWith(github.ref_name, 'port/') && ! startsWith(github.event.pull_request.base.ref, 'port/') }}
uses: neoforged/action-jar-compatibility/upload@v1
- name: Publish artifacts
if: ${{ github.event_name == 'pull_request' }}
uses: neoforged/action-pr-publishing/upload@v1