9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-19 14:59:25 +00:00
Files
DivineMC/.github/workflows/build-12110.yml
2025-12-09 20:21:34 +03:00

90 lines
3.0 KiB
YAML

name: Build DivineMC 1.21.10
on:
push:
branches:
- "ver/1.21.10"
workflow_dispatch:
jobs:
build:
runs-on: blacksmith-8vcpu-ubuntu-2204
if: "!contains(github.event.commits[0].message, '[ci-skip]')"
env:
BUILD_NUMBER: ${{ github.run_number }}
outputs:
build_number: ${{ env.BUILD_NUMBER }}
jar_file: ${{ steps.prepare_jar.outputs.jar_file }}
version: ${{ steps.prepare_jar.outputs.version }}
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup Gradle Cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches/modules-2
~/.gradle/caches/jars-*
~/.gradle/caches/transforms-*
~/.gradle/wrapper
~/.gradle/build-cache-*
~/.gradle/configuration-cache-*
.gradle/patchCache
.gradle/patched
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'patches/**/*.patch') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Gradle Cache Cleanup
run: |
mkdir -p ~/.gradle/caches/modules-2
[ -f ~/.gradle/caches/modules-2/modules-2.lock ] && rm -f ~/.gradle/caches/modules-2/modules-2.lock
find ~/.gradle/caches -name "*.lock" -type f -delete || echo "No lock files found"
- name: Setup JDK 21
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 21
- name: Configure Git and Gradle
run: |
git config --global user.email "no-reply@github.com"
git config --global user.name "Github Actions"
git config --global core.preloadindex true
git config --global core.fscache true
git config --global gc.auto 256
chmod +x gradlew
chmod +x scripts/uploadBuild.sh
- name: Apply Patches
run: |
PARALLELISM=$(($(nproc) * 2))
./gradlew applyAllPatches --stacktrace --parallel --max-workers=$PARALLELISM --build-cache --no-daemon
- name: Build Paperclip Jar
run: ./gradlew createMojmapPaperclipJar --stacktrace --parallel --no-daemon
- name: Prepare and Move Paperclip Jar
id: prepare_jar
run: |
VERSION="1.21.10"
BUILD="${BUILD_NUMBER}"
JAR_NAME="divinemc-${VERSION}-${BUILD}.jar"
mv divinemc-server/build/libs/divinemc-paperclip-*-mojmap.jar divinemc-server/build/libs/${JAR_NAME}
echo "jar_file=divinemc-server/build/libs/${JAR_NAME}" >> $GITHUB_OUTPUT
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "JAR_FILE=divinemc-server/build/libs/${JAR_NAME}" >> $GITHUB_ENV
- name: Upload to API
env:
API_URL: 'https://api.bxteam.org'
API_KEY: ${{ secrets.ATLAS_API_KEY }}
PROJECT_KEY: 'divinemc'
VERSION_BRANCH: 'ver/1.21.10'
JAR_FILE: ${{ env.JAR_FILE }}
run: bash scripts/uploadBuild.sh