Check snapshot/1.21/24w44a #142
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check | |
run-name: Check ${{ inputs.version }} | |
permissions: | |
contents: write | |
on: | |
workflow_call: | |
inputs: | |
branch: | |
required: false | |
type: string | |
version: | |
required: true | |
type: string | |
push_changed: | |
default: true | |
required: false | |
type: boolean | |
publish: | |
default: true | |
required: false | |
type: boolean | |
publish_prs: | |
default: false | |
required: false | |
type: boolean | |
secrets: | |
MAVEN_USER: | |
required: false | |
MAVEN_PASSWORD: | |
required: false | |
DISCORD_WEBHOOK: | |
required: false | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version' | |
required: true | |
push_changed: | |
description: 'Push changed patches' | |
default: true | |
required: false | |
type: boolean | |
publish: | |
description: 'Publish' | |
default: true | |
required: false | |
type: boolean | |
jobs: | |
common: | |
runs-on: ubuntu-latest | |
outputs: | |
discord_fields: ${{ steps.discord_fields.outputs.discord_fields }} | |
test_versions: ${{ steps.test_versions.outputs.test_versions }} | |
version_type: ${{ fromJson(steps.split_version.outputs.result).version_type }} | |
version_name: ${{ fromJson(steps.split_version.outputs.result).version_name }} | |
steps: | |
- uses: actions/github-script@v7 | |
id: split_version | |
env: | |
VERSION: ${{ inputs.version }} | |
with: | |
script: | | |
const version = process.env.VERSION.split("/"); | |
var returnValue = {version_name: version[version.length - 1], version_type: version[0]} | |
return returnValue; | |
- name: Create discord fields json | |
if: ${{ inputs.publish }} | |
id: discord_fields | |
run: | | |
echo "discord_fields<<EOF" >> $GITHUB_OUTPUT | |
jq -n '[ | |
{ | |
"name": "Minecraft Version", | |
"value": $ENV.MC_VERSION, | |
"inline": true | |
} | |
]' >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
env: | |
MC_VERSION: ${{ fromJson(steps.split_version.outputs.result).version_name }} | |
- name: Notify discord of start | |
if: ${{ inputs.publish }} | |
uses: neoforged/action-webhooks@v1 | |
with: | |
webhook_url: ${{ secrets.DISCORD_WEBHOOK }} | |
status: started | |
include_commit_message: 'false' | |
fields: ${{ steps.discord_fields.outputs.discord_fields }} | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.branch || github.ref }} | |
- run: | | |
git config --global user.name github-actions | |
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
cache-read-only: false | |
env: | |
GRADLE_BUILD_ACTION_CACHE_KEY_JOB_INSTANCE: check | |
GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION: ${{ github.run_id }}-${{ github.run_attempt }} | |
- name: Apply and Create patches | |
env: | |
VERSION_NAME: ${{ fromJson(steps.split_version.outputs.result).version_name }} | |
VERSION_TYPE: ${{ fromJson(steps.split_version.outputs.result).version_type }} | |
run: ./gradlew :$VERSION_NAME:projectApplyAll :$VERSION_NAME:projectMakeAll -Ptype=$VERSION_TYPE | |
- name: Check if patches have changed | |
id: check_changes | |
if: ${{ inputs.push_changed }} | |
run: | | |
git add . | |
git diff-index --quiet HEAD || git commit -m "Update patches" && git push | |
- name: Make Zip | |
env: | |
VERSION_NAME: ${{ fromJson(steps.split_version.outputs.result).version_name }} | |
VERSION_TYPE: ${{ fromJson(steps.split_version.outputs.result).version_type }} | |
if: ${{ always() }} | |
run: ./gradlew :$VERSION_NAME:makeZip -Ptype=$VERSION_TYPE | |
- name: Upload Zip as Artifact | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: neoform-${{ fromJson(steps.split_version.outputs.result).version_name }} | |
path: build/distributions/*.zip | |
# This creates a "maven-publish" artifact that contains the results of a locally run publish task | |
# This artifact is picked up by the "publish-prs.yml" workflow for PRs and published to a temporary maven repository | |
- name: Publish artifacts for PR Publication | |
uses: neoforged/action-pr-publishing/upload@v1 | |
if: ${{ inputs.publish_prs }} | |
with: | |
publishing-task: ":${{ fromJson(steps.split_version.outputs.result).version_name }}:publishAllPublicationsTo_githubPackages_PRsRepository -Ptype=${{ fromJson(steps.split_version.outputs.result).version_type }}" | |
- name: Get Java Test Versions | |
id: test_versions | |
env: | |
VERSION: ${{ inputs.version }} | |
NEXT_JDK_VERSION: ${{ vars.NEXT_JDK_VERSION }} | |
run: echo "test_versions=$(cat versions/$VERSION/config.json | jq -c '[range(.java_target; $ENV.NEXT_JDK_VERSION | tonumber)]')" >> "$GITHUB_OUTPUT" | |
testjdks: | |
name: Test Jdks on side ${{ matrix.side }} using mappings ${{ matrix.mappings }} using java version ${{ matrix.jdk_version }} | |
runs-on: ubuntu-latest | |
needs: common | |
strategy: | |
fail-fast: false | |
matrix: | |
jdk_version: ${{ fromJson(needs.common.outputs.test_versions) }} | |
mappings: [HotSpot] | |
side: [Client, Joined, Server] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.branch || github.ref }} | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
cache-read-only: true | |
env: | |
GRADLE_BUILD_ACTION_CACHE_KEY_JOB_INSTANCE: check | |
GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION: ${{ github.run_id }}-${{ github.run_attempt }} | |
- name: Test jdk | |
env: | |
VERSION_NAME: ${{ needs.common.outputs.version_name }} | |
SIDE: ${{ matrix.side }} | |
MAPPINGS: ${{ matrix.mappings }} | |
JDK_VERSION: ${{ matrix.jdk_version }} | |
VERSION_TYPE: ${{ needs.common.outputs.version_type }} | |
run: ./gradlew :$VERSION_NAME:testCompile$SIDE$MAPPINGS$JDK_VERSION :$VERSION_NAME:testDecompile$SIDE$MAPPINGS${JDK_VERSION}Compare -Ptype=$VERSION_TYPE | |
publish: | |
name: Publish to maven | |
runs-on: ubuntu-latest | |
needs: [common, testjdks] | |
outputs: | |
timestamp: ${{ env.GRADLE_TIMESTAMP }} | |
if: ${{ inputs.publish }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.branch || github.ref }} | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
cache-read-only: false | |
env: | |
GRADLE_BUILD_ACTION_CACHE_KEY_JOB_INSTANCE: check | |
- name: Publish | |
env: | |
VERSION_NAME: ${{ needs.common.outputs.version_name }} | |
VERSION_TYPE: ${{ needs.common.outputs.version_type }} | |
ORG_GRADLE_PROJECT_MAVEN_URL: ${{ vars.MAVEN_URL }} | |
ORG_GRADLE_PROJECT_MAVEN_USER: ${{ secrets.MAVEN_USER }} | |
ORG_GRADLE_PROJECT_MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | |
run: ./gradlew getTimestamp :$VERSION_NAME:publish -Ptype=$VERSION_TYPE | |
discord: | |
name: Send status to discord | |
runs-on: ubuntu-latest | |
needs: [common, testjdks, publish] | |
if: ${{ always() && inputs.publish }} | |
steps: | |
- name: Notify discord of finish | |
if: ${{ inputs.publish }} | |
uses: neoforged/action-webhooks@v1 | |
with: | |
webhook_url: ${{ secrets.DISCORD_WEBHOOK }} | |
status: ${{ needs.common.result == 'success' && needs.testjdks.result == 'success' && needs.publish.result || needs.common.result == 'success' && needs.testjdks.result || needs.common.result }} | |
include_commit_message: 'false' | |
version: ${{ needs.publish.result == 'success' && format('{0}-{1}', needs.common.outputs.version_name, needs.publish.outputs.timestamp) || '?' }} | |
fields: ${{ needs.common.outputs.discord_fields }} |