9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00
Files
Leaf/.github/workflows/auto-update.yml
Dreeam 78d8c9b6a7 Update build.gradle.kts.patch
* Merged Gale's
2025-03-26 12:19:34 -04:00

82 lines
2.3 KiB
YAML

name: Automatically update Paper commit hash
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Leaf repository
uses: actions/checkout@main
with:
path: 'Leaf'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout Paper repository
uses: actions/checkout@main
with:
path: 'Paper'
repository: "PaperMC/Paper"
token: ${{ secrets.GITHUB_TOKEN }}
- name: Get Paper latest commit Hash
id: paperCommit
run: |
cd Paper
echo "paperCommit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Get Leaf Current Paper commit Hash
id: currPaperCommit
run: |
cd Leaf
currPaperCommit=$(grep "^paperCommit\s*=" gradle.properties | sed 's/^paperCommit\s*=\s*//')
echo "currPaperCommit=$currPaperCommit" >> $GITHUB_OUTPUT
- name: Update paperCommit in Leaf
run: |
cd Leaf
sed -i "s/\(paperCommit\s*=\s*\).*/\1$PAPER_COMMIT/" gradle.properties
env:
PAPER_COMMIT: ${{ steps.paperCommit.outputs.paperCommit }}
- name: Grant execute permission for gradlew
run: |
cd Leaf
git config --global user.name "Dreeam-qwq"
git config --global user.email 61569423+Dreeam-qwq@users.noreply.github.com
chmod +x gradlew
- uses: actions/setup-java@main
with:
distribution: 'zulu'
java-version: '21'
- name: Running tests before push
run: |
cd Leaf
if ! git diff --quiet; then
echo "Running tests...."
./gradlew applyAllPatches
./gradlew build -x test
./gradlew rebuildPaperPatches
./gradlew rebuildAllServerPatches
fi
- name: Check for changes and write to repository
run: |
cd Leaf
if ! git diff --quiet; then
echo "Writing to repo....."
git add .
chmod +x ./scripts/upstreamCommit.sh
./scripts/upstreamCommit.sh --paper $CURR_PAPER_COMMIT
git push
else
echo "No changes to commit."
fi
env:
CURR_PAPER_COMMIT: ${{ steps.currPaperCommit.outputs.currPaperCommit }}