mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-19 14:59:30 +00:00
32 lines
1.1 KiB
Bash
Executable File
32 lines
1.1 KiB
Bash
Executable File
exit_on_error() {
|
|
echo "$1"
|
|
exit 1
|
|
}
|
|
|
|
#git reset HEAD --hard
|
|
|
|
oldHash=$(grep "paperRef=" gradle.properties | cut -d "=" -f2)
|
|
newHash=$(curl -s https://api.github.com/repos/PaperMC/paper/commits/$1 | jq -r .sha)
|
|
|
|
if [ "$oldHash" = "$newHash" ]; then
|
|
echo "Upstream has not updated!"
|
|
exit 0
|
|
fi
|
|
|
|
echo "Updating paper: $oldHash -> $newHash"
|
|
|
|
sed -i "s/$oldHash/$newHash/g" gradle.properties
|
|
git add gradle.properties
|
|
|
|
./gradlew cleanCache
|
|
./gradlew applyPaperSingleFilePatchesFuzzy || exit_on_error "An error occurred when applying single file patches!"
|
|
./gradlew rebuildPaperSingleFilePatches || exit_on_error "An error occurred when rebuilding single file patches!"
|
|
./gradlew applyAllPatches || exit_on_error "An error occurred when merging patches!"
|
|
./gradlew rebuildPaperApiPatches || exit_on_error "An error occurred when rebuilding api patches!"
|
|
./gradlew rebuildAllServerPatches || exit_on_error "An error occurred when rebuilding server patches!"
|
|
./gradlew createMojmapPaperclipJar || exit_on_error "An error occurred when building!"
|
|
|
|
scripts/upstreamCommit.sh $oldHash $newHash
|
|
|
|
echo "Created new commit, please review before pushing."
|