forked from GaleMC/Gale
-
Notifications
You must be signed in to change notification settings - Fork 1
80 lines (70 loc) · 2.23 KB
/
auto-update.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Automatically update Paper commit hash
on:
workflow_dispatch:
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: |
cd Paper
echo "paperRef=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Get Gale Current Paper commit Hash
id: currPaperRef
run: |
cd Gale
currPaperRef=$(grep "^paperRef\s*=" gradle.properties | sed 's/^paperRef\s*=\s*//')
echo "currPaperRef=$currPaperRef" >> $GITHUB_OUTPUT
- name: Update paperRef in Gale
run: |
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: |
cd Gale
git config --global user.name "Dreeam"
git config --global user.email 61569423+Dreeam-qwq@users.noreply.github.com
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 }}