9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-25 01:49:16 +00:00

Cleanup workflow & Refactor Leaf release to replace deprecated one (#244)

* [ci/skip] Cleanup workflow & Update relaeses

* Correct output jar name

* Correct format

* Cleanup publish API

* Upload tag retrival test

* Fix

* test

* Fix build

* Update release notes scripts

* Fix github env

* Fix

* Fix format

* Add missing env

* Update workflow for test

* Update prepareRelease.sh

* Update workflow for test

* Fix

* Use full commit hash for commit log link & Format

* [ci/skip] Ready for merge
This commit is contained in:
Dreeam
2025-03-07 08:44:26 -05:00
committed by GitHub
parent 79e012073d
commit f77ea9f730
3 changed files with 120 additions and 33 deletions

View File

@@ -10,7 +10,6 @@ jobs:
env:
BUILD_NUMBER: ${{ github.run_number }}
GRAALVM_ARGS: "-Dgraal.CompilerConfiguration=enterprise -Dgraal.UsePriorityInlining=true -Dgraal.Vectorization=true -Dgraal.OptDuplication=true -Dgraal.LoopUnroll=true -Dgraal.SpeculativeGuardMovement=true --add-modules jdk.incubator.vector"
GRADLE_OPTS: "-Dorg.gradle.parallel=true -Dorg.gradle.caching=true -Dorg.gradle.configureondemand=true -Dkotlin.incremental=true"
GRADLE_MEMORY: "-Xmx4g -XX:MaxMetaspaceSize=2g"
PATCH_PARALLELISM: "16"
outputs:
@@ -19,8 +18,8 @@ jobs:
- name: Checkout repository
uses: actions/checkout@main
with:
fetch-depth: 50
fetch-depth: 0
- name: Setup Gradle Cache
uses: useblacksmith/cache@v5
with:
@@ -35,24 +34,23 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'buildSrc/**/*.kt', '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
[ -f ~/.gradle/caches/modules-2/gc.properties ] && rm -f ~/.gradle/caches/modules-2/gc.properties
find ~/.gradle/caches -name "*.lock" -type f -delete || echo "No lock files found to delete"
- name: Set up GraalVM JDK 21
uses: graalvm/setup-graalvm@main
with:
java-version: 21
github-token: "${{ secrets.GITHUB_TOKEN }}"
set-java-home: true
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Configure Git
run: |
git config --global user.email "no-reply@github.com"
@@ -61,7 +59,7 @@ jobs:
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
@@ -72,7 +70,7 @@ jobs:
echo "kotlin.incremental=true" >> ~/.gradle/gradle.properties
# Add patch parallelism configuration
echo "leafPatches.parallelism=${{ env.PATCH_PARALLELISM }}" >> ~/.gradle/gradle.properties
- name: Apply patches
run: |
# Analyze available system resources for optimal settings
@@ -85,23 +83,19 @@ jobs:
applyAllPatches \
--stacktrace --no-daemon --parallel \
--max-workers=8
- name: Create MojmapPaperclipJar
run: ./gradlew -Dorg.gradle.jvmargs="${{ env.GRAALVM_ARGS }} ${{ env.GRADLE_MEMORY }}" createMojmapPaperclipJar --stacktrace --no-daemon --parallel --max-workers=8
- name: Create ReobfPaperclipJar
run: ./gradlew -Dorg.gradle.jvmargs="${{ env.GRAALVM_ARGS }} ${{ env.GRADLE_MEMORY }}" -Dpaperweight.debug=true createReobfPaperclipJar --stacktrace --no-daemon --parallel --max-workers=8
# Start API publishing in background
- name: Start API Publishing
id: publish-api
run: |
echo "Starting API publishing in background..."
(
echo "REPO_USER=${{ secrets.REPO_USER }}" >> $GITHUB_ENV
export REPO_USER=${{ secrets.REPO_USER }}
echo "REPO_PASSWORD=${{ secrets.REPO_PASSWORD }}" >> $GITHUB_ENV
export REPO_PASSWORD=${{ secrets.REPO_PASSWORD }}
./gradlew -Dorg.gradle.jvmargs="${{ env.GRAALVM_ARGS }} ${{ env.GRADLE_MEMORY }}" publish --parallel --max-workers=4 > publish_api_log.txt 2>&1
# Uncomment when ready to implement:
# ./gradlew -Dorg.gradle.jvmargs="${{ env.GRAALVM_ARGS }} ${{ env.GRADLE_MEMORY }}" publishDevBundlePublicationToLeafRepository -PpublishDevBundle=true --parallel >> publish_api_log.txt 2>&1
@@ -111,7 +105,10 @@ jobs:
# Store the background process ID
echo "PUBLISH_PID=$!" >> $GITHUB_ENV
echo "API publishing started in background with PID $!"
env:
REPO_USER: ${{ secrets.REPO_USER }}
REPO_PASSWORD: ${{ secrets.REPO_PASSWORD }}
- name: Gradle Cache Prune
run: |
if [ -d ~/.gradle/caches ]; then
@@ -124,21 +121,27 @@ jobs:
else
echo "Gradle cache directory does not exist yet"
fi
- 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
mv leaf-server/build/libs/leaf-paperclip-1.21.4-R0.1-SNAPSHOT-reobf.jar ./leaf-1.21.4-${{ env.BUILD_NUMBER }}-reobf.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 jar for release
run: mv ./leaf-1.21.4-${{ env.BUILD_NUMBER }}-mojmap.jar ./leaf-1.21.4-${{ env.BUILD_NUMBER }}.jar
- name: Prepare for release
continue-on-error: true
run: |
chmod +x ./scripts/prepareRelease.sh
./scripts/prepareRelease.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPO: ${{ github.repository }}
# Wait for API publishing to complete before releasing
- name: Wait for API Publishing
run: |
@@ -160,14 +163,14 @@ jobs:
else
echo "API publishing completed successfully."
fi
- name: Release Leaf
# TODO: Replace with a maintained action as marvinpinto/action-automatic-releases is archived
# Recommended alternatives: softprops/action-gh-release or ncipollo/release-action
uses: marvinpinto/action-automatic-releases@master
uses: softprops/action-gh-release@master
with:
title: "Leaf 1.21.4"
automatic_release_tag: "ver-1.21.4"
repo_token: "${{ secrets.GITHUB_TOKEN }}"
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 }}"
prerelease: false