Skip to content

Automatically update Luminol commit hash #76

Automatically update Luminol commit hash

Automatically update Luminol commit hash #76

Workflow file for this run

name: Automatically update Luminol commit hash
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * 1"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout LightingLuminol repository
uses: actions/checkout@v6
with:
path: LightingLuminol
token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout Luminol repository
uses: actions/checkout@v6
with:
path: Luminol
repository: LuminolMC/Luminol
token: ${{ secrets.GITHUB_TOKEN }}
- name: Get Luminol latest commit Hash
id: luminolRef
run: |
cd Luminol
echo "NEW_LUMINOL_REF=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Get LightingLuminol Current Luminol commit Hash
id: currLuminolRef
run: |
cd LightingLuminol
OLD_LUMINOL_REF=$(grep "^luminolRef\s*=" gradle.properties | sed 's/^luminolRef\s*=\s*//')
if [ -z "$OLD_LUMINOL_REF" ]; then
echo "❌ ERROR: luminolRef not found in gradle.properties"
exit 1
fi
echo "OLD_LUMINOL_REF=$OLD_LUMINOL_REF" >> $GITHUB_OUTPUT
- name: Update luminolRef in LightingLuminol
run: |
cd LightingLuminol
if [ -n "$NEW_LUMINOL_REF" ]; then
if grep -q "^luminolRef\s*=" gradle.properties; then
sed -i "s/\(luminolRef\s*=\s*\).*/\1$NEW_LUMINOL_REF/" gradle.properties
else
echo "luminolRef=$NEW_LUMINOL_REF" >> gradle.properties
fi
else
echo "❌ NEW_LUMINOL_REF is empty — skipping update to gradle.properties"
exit 1
fi
env:
NEW_LUMINOL_REF: ${{ steps.luminolRef.outputs.NEW_LUMINOL_REF }}
- name: Grant execute permission for gradlew
run: |
cd LightingLuminol
git config --global user.name "Bacteriawa"
git config --global user.email "A3167717663@hotmail.com"
chmod +x gradlew
- uses: actions/setup-java@v5
with:
distribution: zulu
java-version: 21
- name: Running tests before push
run: |
cd LightingLuminol
if ! git diff --quiet; then
echo "Running tests...."
./gradlew applyAllPatches
./gradlew build -x test
./gradlew rebuildPaperApiPatches
./gradlew rebuildAllServerPatches
fi
- name: Check for changes and write to repository
run: |
cd LightingLuminol
if ! git diff --quiet; then
echo "Writing to repo....."
git add .
chmod +x ./scripts/Upstream.sh
./scripts/Upstream.sh --luminol $OLD_LUMINOL_REF
git push
else
echo "No changes to commit."
exit 78
fi
env:
OLD_LUMINOL_REF: ${{ steps.currLuminolRef.outputs.OLD_LUMINOL_REF }}