Update copilot-instructions.md #225
This file contains hidden or 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: Java CI with Gradle | |
on: | |
push: | |
branches: | |
- '**' | |
pull_request: | |
branches: | |
- '**' | |
permissions: | |
pull-requests: write | |
env: | |
MARKER: '🎈' | |
jobs: | |
define-versions: | |
runs-on: ubuntu-latest | |
outputs: | |
versions: ${{ steps.versions.outputs.versions }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Define Versions | |
id: versions | |
run: | | |
versions="[" | |
for item in $(ls mc); do | |
versions+="\"$item\", " | |
done | |
versions="${versions%,*}]" | |
echo "versions=$versions" >> "$GITHUB_OUTPUT" | |
- name: Ensure that versions.json includes all versions | |
run: node -e 'const fs = require("fs"); const versions = JSON.parse(fs.readFileSync("versions.json", "utf8")); const expectedVersions = fs.readdirSync("mc"); if (expectedVersions.length !== versions.length || !expectedVersions.every(v => versions.includes(v))) { throw new Error("versions.json does not match the expected versions in mc/ folder"); }' | |
build: | |
needs: define-versions | |
strategy: | |
fail-fast: false | |
matrix: | |
version: ${{ fromJSON(needs.define-versions.outputs.versions) }} | |
name: Build ${{ matrix.version }} | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Validate Gradle wrapper | |
uses: gradle/actions/wrapper-validation@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
add-job-summary-as-pr-comment: on-failure | |
- name: Generate ${{ matrix.version }} | |
run: ./gradlew :mc:${{ matrix.version }}:runServer --stacktrace | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: data-${{ matrix.version }} | |
path: mc/${{ matrix.version }}/run/server/minecraft-data | |
if-no-files-found: error | |
repackage: | |
needs: build | |
name: Repackage versions | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- run: npm install | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
merge-multiple: true | |
- name: Upload artifact | |
id: uploadMerged | |
uses: actions/upload-artifact@v4 | |
with: | |
name: merged-data | |
path: artifacts/* | |
if-no-files-found: error | |
- run: cat "$GITHUB_EVENT_PATH" | |
- name: Sending artifacts to minecraft-data | |
# Check if PR starts with marker | |
if: startsWith(github.event.pull_request.title, env.MARKER) | |
env: | |
ARTIFACT_URL: ${{ steps.uploadMerged.outputs.artifact-url }} | |
GITHUB_TOKEN: ${{ secrets.PAT_PASSWORD }} | |
PR_TITLE: ${{ github.event.pull_request.title }} | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
run: node .github/commands/send.js |