115 lines
3.7 KiB
YAML
115 lines
3.7 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- master
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
|
PACKAGE_OWNER: MrSphay
|
|
PACKAGE_NAME: warium-neoforge-1.21.1
|
|
APP_VERSION: 1.2.7-neo.21.1.225
|
|
LATEST_FILE: warium-neoforge-1.21.1-latest.jar
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Java 21
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: '21'
|
|
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Generate port sources
|
|
run: python tools/generate_port_sources.py
|
|
|
|
- name: Decompile original for audit artifact
|
|
run: python tools/decompile_original.py
|
|
|
|
- name: Check required integrations
|
|
run: python tools/check_required_integrations.py
|
|
|
|
- name: Registry parity
|
|
run: python tools/registry_parity.py
|
|
|
|
- name: Build
|
|
run: ./gradlew --no-daemon build
|
|
|
|
- name: Prepare runtime dependency mods
|
|
run: python tools/prepare_runtime_mods.py
|
|
|
|
- name: Run data generation
|
|
run: ./gradlew --no-daemon runData
|
|
|
|
- name: Dedicated server smoke test
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
mkdir -p run/server/mods
|
|
cp build/libs/*.jar run/server/mods/
|
|
echo "eula=true" > run/server/eula.txt
|
|
timeout 120s ./gradlew --no-daemon runServer || code=$?
|
|
code="${code:-0}"
|
|
if [ "$code" != "0" ] && [ "$code" != "124" ]; then
|
|
exit "$code"
|
|
fi
|
|
|
|
- name: Upload build artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: warium-neoforge-1.21.1-artifacts
|
|
path: |
|
|
build/libs/*.jar
|
|
docs/inventory/*.json
|
|
docs/inventory/*.md
|
|
build/decompiled/**
|
|
|
|
- name: Publish private latest package
|
|
if: ${{ env.REGISTRY_TOKEN != '' }}
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
package_version="${APP_VERSION}-${GITHUB_SHA::7}"
|
|
package_dir="package-registry"
|
|
mkdir -p "${package_dir}/versioned" "${package_dir}/latest"
|
|
|
|
artifact="$(find build/libs -maxdepth 1 -type f -name '*.jar' ! -name '*-sources.jar' | head -n 1)"
|
|
if [ -z "${artifact}" ]; then
|
|
echo "No jar artifact found"
|
|
exit 1
|
|
fi
|
|
|
|
versioned_file="warium-neoforge-1.21.1-${package_version}.jar"
|
|
cp "${artifact}" "${package_dir}/versioned/${versioned_file}"
|
|
cp "${artifact}" "${package_dir}/latest/${LATEST_FILE}"
|
|
|
|
curl --fail-with-body \
|
|
--user "${PACKAGE_OWNER}:${REGISTRY_TOKEN}" \
|
|
--upload-file "${package_dir}/versioned/${versioned_file}" \
|
|
"https://git.wilkensxl.de/api/packages/${PACKAGE_OWNER}/generic/${PACKAGE_NAME}/${package_version}/${versioned_file}"
|
|
|
|
curl --silent --show-error \
|
|
--user "${PACKAGE_OWNER}:${REGISTRY_TOKEN}" \
|
|
--request DELETE \
|
|
"https://git.wilkensxl.de/api/packages/${PACKAGE_OWNER}/generic/${PACKAGE_NAME}/latest" || true
|
|
|
|
curl --fail-with-body \
|
|
--user "${PACKAGE_OWNER}:${REGISTRY_TOKEN}" \
|
|
--upload-file "${package_dir}/latest/${LATEST_FILE}" \
|
|
"https://git.wilkensxl.de/api/packages/${PACKAGE_OWNER}/generic/${PACKAGE_NAME}/latest/${LATEST_FILE}"
|
|
|
|
curl --fail --head \
|
|
--user "${PACKAGE_OWNER}:${REGISTRY_TOKEN}" \
|
|
"https://git.wilkensxl.de/api/packages/${PACKAGE_OWNER}/generic/${PACKAGE_NAME}/latest/${LATEST_FILE}"
|