forked from JnCrMx/discord-game-sdk4j
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prepare-release.sh
executable file
·56 lines (42 loc) · 1.87 KB
/
prepare-release.sh
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
#!/bin/bash
git describe --tags --exact-match > /dev/null 2>/dev/null
if [ $? -ne 0 ]; then
echo "`tput setaf 1``tput bold`no Git tag found for current commit`tput sgr0`"
exit 2
fi
gitversion=$(git describe --tags --abbrev=0 | tr -d "v")
mvnversion=$(grep -P '<version>[\d\.]+<\/version>' pom.xml | head -n1 | sed 's/<version>\([0-9\.]*\)<\/version>/\1/g' | tr -d "\t")
if [ "$gitversion" != "$mvnversion" ]; then
echo "`tput setaf 1``tput bold`Git tag $gitversion does not match Maven version $mvnversion`tput sgr0`"
exit 2
fi
mvn -DskipTests=true clean package
check_and_copy ()
{
src=$1
dst=$2
stat $src > /dev/null 2>/dev/null
if [ $? -ne 0 ]; then
echo "`tput setaf 1``tput bold`file not found: $src`tput sgr0`"
exit 2
fi
cp $src $dst
if [ $? -ne 0 ]; then
echo "`tput setaf 1``tput bold`could not copy $src to $dst`tput sgr0`"
exit 2
fi
}
release=target/release
mkdir -p $release
# JARs
check_and_copy target/discord-game-sdk4j-$mvnversion.jar $release/discord-game-sdk4j-$mvnversion.jar
check_and_copy target/discord-game-sdk4j-$mvnversion-javadoc.jar $release/discord-game-sdk4j-$mvnversion-javadoc.jar
check_and_copy target/discord-game-sdk4j-$mvnversion-sources.jar $release/discord-game-sdk4j-$mvnversion-sources.jar
# Windows
check_and_copy target/classes/native/windows/amd64/discord_game_sdk_jni.dll $release/windows-amd64-discord_game_sdk_jni.dll
check_and_copy target/classes/native/windows/x86/discord_game_sdk_jni.dll $release/windows-x86-discord_game_sdk_jni.dll
# Linux
check_and_copy target/classes/native/linux/amd64/libdiscord_game_sdk_jni.so $release/linux-amd64-libdiscord_game_sdk_jni.so
# macOS
check_and_copy target/classes/native/macos/amd64/libdiscord_game_sdk_jni.dylib $release/macos-amd64-libdiscord_game_sdk_jni.dylib
echo "`tput setaf 2``tput bold`Success! Release artifacts for version $gitversion can now be found in $release`tput sgr0`"