-
Notifications
You must be signed in to change notification settings - Fork 16
/
package-release
executable file
·50 lines (38 loc) · 1.21 KB
/
package-release
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
#!/bin/sh
dirty=false
die() {
printf %s\\n "$*" >&2
exit 1
}
need_installed() {
command -v "$1" >/dev/null || die "You must have $1 installed to run this script"
}
need_installed perl
need_installed zip
need_installed unix2dos
version=$(perl -Mv5.10 -ne '/version = "([^"]+)"/ && say $1' build.gradle.kts) || exit
name=osrs-environment-exporter
full_name=$name-$version
src_jar_name=$name-fat-$version.jar
jar_name=$full_name.jar
zip_name=$full_name.zip
dir_name=$full_name
destdir=build/dist
full_path=$destdir/$full_name
if ! git diff --quiet; then
dirty=true
echo 'Warning: Not working from a clean branch!' >&2
fi
rm -rf -- "$destdir" || exit
./gradlew clean build || exit
mkdir -p -- "$destdir/$full_name" || exit
cp -- run run.bat LICENSE README.md CHANGELOG.md "build/libs/$src_jar_name" "$full_path" || exit
mv -- "$full_path/$src_jar_name" "$full_path/$jar_name"
perl -i -ple 's,/build/libs(.*)-fat,$1,' "$full_path/run" "$full_path/run.bat" || exit
unix2dos "$full_path/run.bat" || exit
cd -- "$destdir" || exit
zip -r "$zip_name" "$full_name" || exit
if $dirty; then
echo 'Warning: This was not built from a clean branch!' >&2
fi
echo "Zip is at $destdir/$zip_name <file://$PWD/$zip_name>"