Use SSE Events to push realtime data from the internal server to the webmap #55
Workflow file for this run
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
# Here lie dragons! | |
# | |
# This action builds a jar to be updated in the body | |
# of the PR relating to this action. | |
# | |
# Created by PaperMC contributors for Paper, modified by granny | |
name: Build Pl3xMap PR | |
on: | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- labeled | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java: [17] | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v4 | |
- name: JDK ${{ matrix.java }} | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: 'temurin' | |
- name: Validate Gradle wrapper | |
uses: gradle/wrapper-validation-action@v2 | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Configure Build | |
uses: actions/github-script@v6 | |
id: determine | |
with: | |
script: | | |
const {owner, repo} = context.repo; | |
const event_name = "${{ github.event_name }}"; | |
const event = ${{ toJSON(github.event) }}; | |
const ref_type = "${{ github.ref_type }}"; | |
const ref_name = "${{ github.ref_name }}"; | |
const result = { | |
action: "build" | |
}; | |
if (event_name === "pull_request" && event.pull_request.labels.find((l) => l.name === "build-pr-jar")) { | |
result["pr"] = event.pull_request.number; | |
result["action"] = "pl3xmap"; | |
core.notice(`This is a pull request action with a build pl3xmap label (${JSON.stringify(result)})`); | |
return result; | |
} | |
core.notice("This will not build a pl3xmap jar"); | |
return result; | |
- name: Build | |
run: ./gradlew build --stacktrace | |
- name: Upload Pl3xMap Jar | |
if: fromJSON(steps.determine.outputs.result).action == 'pl3xmap' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pl3xmap-${{ fromJSON(steps.determine.outputs.result).pr }} | |
path: build/libs/Pl3xMap-*-SNAPSHOT.jar | |
event_file: | |
name: "Event File" | |
# Only run on PRs if the source branch is on someone else's repo | |
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Event File | |
path: ${{ github.event_path }} |