9
0
mirror of https://github.com/Dreeam-qwq/Gale.git synced 2025-12-26 10:09:11 +00:00
Files
Gale/.github/workflows/auto-update.yml
Dreeam bbfd94037b debug
2024-07-18 02:39:22 +08:00

86 lines
2.3 KiB
YAML

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