-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
publish_release.sh
executable file
·78 lines (65 loc) · 2.01 KB
/
publish_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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
RELEASEDIR=ChebsNecromancy/bin/Release/net48
DLL=$RELEASEDIR/ChebsNecromancy.dll
LIB=$RELEASEDIR/ChebsValheimLibrary.dll
BUN=chebs-necromancy-unity/Assets/AssetBundles/chebgonaz
PLUGINS=ChebsNecromancy/Package/plugins
README=README.md
TRANSLATIONS=Translations
VERSION=$1
# Check that source files exist and are readable
if [ ! -f "$DLL" ]; then
echo "Error: $DLL does not exist or is not readable."
exit 1
fi
if [ ! -f "$LIB" ]; then
echo "Error: $LIB does not exist or is not readable."
exit 1
fi
if [ ! -f "$BUN" ]; then
echo "Error: $BUN does not exist or is not readable."
exit 1
fi
# Check that target directory exists and is writable
if [ ! -d "$PLUGINS" ]; then
echo "Error: $PLUGINS directory does not exist."
exit 1
fi
if [ ! -w "$PLUGINS" ]; then
echo "Error: $PLUGINS directory is not writable."
exit 1
fi
if [ ! -f "$README" ]; then
echo "Error: $README does not exist or is not readable."
exit 1
fi
cp -f "$DLL" "$PLUGINS" || { echo "Error: Failed to copy $DLL"; exit 1; }
cp -f "$LIB" "$PLUGINS" || { echo "Error: Failed to copy $LIB"; exit 1; }
cp -f "$BUN" "$PLUGINS" || { echo "Error: Failed to copy $BUN"; exit 1; }
cp -f "$README" "$PLUGINS/../README.md" || { echo "Error: Failed to copy $README"; exit 1; }
cp -rf "$TRANSLATIONS" "$PLUGINS/" || { echo "Error: Failed to copy Translations"; exit 1; }
# merging causes problems with the mods when installed together, so I'm disabling this
#
# create dir if not existing
#if [ ! -d "$RELEASEDIR/merged" ]; then
# mkdir $RELEASEDIR/merged
#fi
#
#cp -f $BEPINEX $RELEASEDIR
#cd $RELEASEDIR
#
#mono ../../../packages/ILRepack.2.0.18/tools/ILRepack.exe /out:merged/ChebsNecromancy.dll $(basename "$LIB") $(basename "$DLL")
#
#if [ $? != 0 ]; then
# echo "Merging failed"
# exit 1
#fi
#
#cd ../../../
#cp -f $RELEASEDIR/merged/ChebsNecromancy.dll $PLUGINS
ZIPDESTINATION="../bin/Release/ChebsNecromancy.$VERSION.zip"
cd "$PLUGINS/.."
if [ ! -z "$VERSION" ]; then
VERSION=".$VERSION"
fi
zip -r "$ZIPDESTINATION" .