-
Notifications
You must be signed in to change notification settings - Fork 2
93 lines (79 loc) · 3.08 KB
/
plazma.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
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Scheduled Task (Plazma/1.20.6, Upstream)
on:
push:
workflow_dispatch:
schedule:
- cron: "*/20 * * * *"
env:
MAIN: Plazma
MAIN_REPO: PlazmaMC/PlazmaBukkit
MAIN_BRANCH: dev/1.20.6
JDK: 21
jobs:
update-upstream:
name: Try to update upstreams
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ env.MAIN }}
uses: actions/checkout@v3
with:
repository: ${{ env.MAIN_REPO }}
path: ${{ env.MAIN }}
ref: ${{ env.MAIN_BRANCH }}
token: ${{ secrets.GH_PAT }}
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
github-token: ${{ secrets.GH_PAT }}
java-version: ${{ env.JDK }}
version: latest
cache: 'gradle'
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setup Workflow
run: |
cd ${{ env.MAIN }}
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git config --global pull.rebase true
./gradlew --stacktrace
- name: Determine if an update is required
id: check
run: |
cd ${{ env.MAIN }}
paper=$(./gradlew -q --no-rebuild checkPaper)
purpur=$(./gradlew -q --no-rebuild checkPurpur)
echo "paper=$paper" >> $GITHUB_OUTPUT; echo "purpur=$purpur" >> $GITHUB_OUTPUT
echo "Paper: $paper, Purpur: $purpur"
- name: Update Upstream
if: steps.check.outputs.paper == 'false' || steps.check.outputs.purpur == 'false'
run: |
cd ${{ env.MAIN }}
if ${{ steps.check.outputs.purpur }}
then if ${{ steps.check.outputs.paper }}; then echo; else ./gradlew --no-rebuild --stacktrace updateUpstream; fi
else ./gradlew --no-rebuild --stacktrace updateImplementation
fi
./gradlew applyPatches --stacktrace
- name: Rebuild Patches
if: steps.check.outputs.paper == 'false' || steps.check.outputs.purpur == 'false'
run: |
cd ${{ env.MAIN }}
./gradlew --no-rebuild --stacktrace rebuildPatches
- name: Test build
if: steps.check.outputs.paper == 'false' || steps.check.outputs.purpur == 'false'
run: |
cd ${{ env.MAIN }}
./gradlew --stacktrace build
- name: Commit Changes
if: steps.check.outputs.paper == 'false' || steps.check.outputs.purpur == 'false'
run: |
cd ${{ env.MAIN }}
if ${{ steps.check.outputs.paper }}; then echo; else updated=Paper; fi
if ${{ steps.check.outputs.purpur }}; then echo; else
if [[ -z "$updated" ]]; then updated=Purpur; else updated="$updated, Purpur"; fi
fi
git add .
printf "Updated Upstream ($updated)\n\nUpstream has released updates that appear to apply and compile correctly\n\n$(cat compare.txt)" | git commit -F -
git fetch
git pull origin ${{ env.MAIN_BRANCH }}
git push origin ${{ env.MAIN_BRANCH }}