mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-26 18:39:23 +00:00
124 lines
4.5 KiB
YAML
124 lines
4.5 KiB
YAML
name: Build Leaf 1.21.4
|
|
on:
|
|
push:
|
|
branches: [ "ver/1.21.4" ]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: blacksmith-8vcpu-ubuntu-2204
|
|
env:
|
|
BUILD_NUMBER: ${{ github.run_number }}
|
|
GRADLE_MEMORY: "-Xmx4g -XX:MaxMetaspaceSize=2g"
|
|
outputs:
|
|
build_number: ${{ env.BUILD_NUMBER }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@main
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Gradle Cache
|
|
uses: useblacksmith/cache@v5
|
|
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 java
|
|
uses: useblacksmith/setup-java@v5
|
|
with:
|
|
distribution: 'temurin'
|
|
java-version: '21'
|
|
|
|
- name: Configure Git
|
|
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
|
|
|
|
- name: Configure Gradle Properties
|
|
run: |
|
|
mkdir -p ~/.gradle
|
|
echo "org.gradle.caching=true" >> ~/.gradle/gradle.properties
|
|
echo "org.gradle.configuration-cache=true" >> ~/.gradle/gradle.properties
|
|
echo "org.gradle.configuration-cache.problems=warn" >> ~/.gradle/gradle.properties
|
|
echo "org.gradle.jvmargs=${{ env.GRADLE_MEMORY }} -Dfile.encoding=UTF-8" >> ~/.gradle/gradle.properties
|
|
echo "org.gradle.parallel=true" >> ~/.gradle/gradle.properties
|
|
echo "org.gradle.daemon=true" >> ~/.gradle/gradle.properties
|
|
# This is only need if we create custom gradle.properies in home directory
|
|
echo "leafUsername=${{ secrets.REPO_USER }}" >> ~/.gradle/gradle.properties
|
|
echo "leafPassword=${{ secrets.REPO_PASSWORD }}" >> ~/.gradle/gradle.properties
|
|
|
|
- name: Apply patches
|
|
run: |
|
|
PARALLELISM=$(($(nproc) * 2))
|
|
./gradlew -Dorg.gradle.jvmargs="${{ env.GRADLE_MEMORY }}" \
|
|
-Dleaf.patcher.parallelism=$PARALLELISM \
|
|
-Dleaf.patcher.incremental=true \
|
|
applyAllPatches \
|
|
--stacktrace --parallel \
|
|
--max-workers=$PARALLELISM \
|
|
--build-cache \
|
|
--no-daemon
|
|
|
|
- name: Create MojmapPaperclipJar
|
|
run: ./gradlew createMojmapPaperclipJar --stacktrace --parallel --no-daemon
|
|
|
|
- name: Publish API
|
|
continue-on-error: true
|
|
run: |
|
|
./gradlew :leaf-api:publish
|
|
./gradlew publishDevBundlePublicationToLeafRepository -PpublishDevBundle=true
|
|
env:
|
|
REPO_USER: ${{ secrets.REPO_USER }}
|
|
REPO_PASSWORD: ${{ secrets.REPO_PASSWORD }}
|
|
|
|
- name: Rename Paperclip JARs
|
|
run: |
|
|
mv leaf-server/build/libs/leaf-paperclip-1.21.4-R0.1-SNAPSHOT-mojmap.jar ./leaf-1.21.4-${{ env.BUILD_NUMBER }}-mojmap.jar
|
|
|
|
- name: Upload Leaf as build artifact
|
|
uses: actions/upload-artifact@main
|
|
with:
|
|
name: Leaf 1.21.4
|
|
path: ./leaf-1.21.4-*.jar
|
|
|
|
- name: Prepare release notes and artifacts
|
|
run: |
|
|
chmod +x ./scripts/prepareRelease.sh
|
|
./scripts/prepareRelease.sh
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
GITHUB_REPO: ${{ github.repository }}
|
|
BUILD_NUMBER: ${{ env.BUILD_NUMBER }}
|
|
|
|
- name: Release Leaf
|
|
uses: softprops/action-gh-release@master
|
|
with:
|
|
name: "Leaf 1.21.4"
|
|
tag_name: "ver-1.21.4"
|
|
files: "./leaf-1.21.4-${{ env.BUILD_NUMBER }}.jar"
|
|
body_path: "./release_notes.md"
|
|
token: "${{ secrets.GITHUB_TOKEN }}"
|
|
target_commitish: "${{ github.sha }}"
|
|
draft: false
|
|
prerelease: false
|