MC/.forgejo/workflows/plugins.yml

86 lines
3.1 KiB
YAML

name: DuneRealms Plugin CI
on:
workflow_dispatch:
push:
branches: [main]
paths:
- '.forgejo/workflows/plugins.yml'
- 'Dune*/**'
- 'JarvisConnector/**'
- 'gui-common/**'
- 'network/proxy/central-pack/**'
jobs:
plugins:
runs-on: dune-ci
steps:
- name: Check out exact revision
shell: bash
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
git init .
git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --depth=1 "https://www.dunerealms.com/git/${GITHUB_REPOSITORY}.git" "$GITHUB_SHA"
git checkout --detach FETCH_HEAD
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
- uses: gradle/actions/setup-gradle@v4
with:
gradle-version: '9.2.1'
- name: Test and build first-party plugins
shell: bash
run: |
set -euo pipefail
modules=(DuneEss DuneLobby DuneNPC DuneRealms-minecraft-only DuneRealmsGUI DuneTerrain JarvisConnector)
if [[ -f network/proxy/central-pack/build.gradle.kts ]]; then
modules+=(network/proxy/central-pack)
fi
mkdir -p plugin-artifacts
for module in "${modules[@]}"; do
gradle --no-daemon -p "$module" test jar
for jar in "$module"/build/libs/*.jar; do
test -f "$jar"
artifact="plugin-artifacts/${jar##*/}"
test ! -e "$artifact"
cp "$jar" "$artifact"
done
done
printf '%s\n' "$(git rev-parse HEAD)" > plugin-artifacts/SOURCE_COMMIT
(cd plugin-artifacts && sha256sum -- *.jar SOURCE_COMMIT > SHA256SUMS)
- uses: actions/upload-artifact@v3
with:
name: DuneRealms-Plugins
path: plugin-artifacts/
if-no-files-found: error
- name: Test and build the replacement DuneMenus plugin
if: github.repository == 'dev/MC'
run: gradle --no-daemon -p DuneMenus test jar
- uses: actions/upload-artifact@v3
if: github.repository == 'dev/MC'
with:
name: DuneMenus-Development
path: DuneMenus/build/libs/DuneMenus.jar
if-no-files-found: error
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '25'
- name: Build optional Paper 26.2 fullscreen provider
shell: bash
run: |
set -euo pipefail
gradle --no-daemon -p DuneFullscreenPaper test jar
mkdir -p fullscreen-artifacts
cp DuneFullscreenPaper/build/libs/DuneFullscreenPaper.jar fullscreen-artifacts/
printf '%s\n' "$(git rev-parse HEAD)" > fullscreen-artifacts/SOURCE_COMMIT
(cd fullscreen-artifacts && sha256sum -- DuneFullscreenPaper.jar SOURCE_COMMIT > SHA256SUMS)
- uses: actions/upload-artifact@v3
with:
name: DuneRealms-Fullscreen-Paper-Development
path: fullscreen-artifacts/
if-no-files-found: error