generated from Valheim-Modding/JotunnModStub
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
publish_release.sh
executable file
·59 lines (46 loc) · 1.56 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
#!/bin/bash
RELEASEDIR=ChebsMythicalWeapons/bin/Release/net48
DLL=$RELEASEDIR/ChebsMythicalWeapons.dll
LIB=$RELEASEDIR/ChebsValheimLibrary.dll
BUN=chebs-mythical-weapons-unity/Assets/AssetBundles/chebsmythicalweapons
PLUGINS=ChebsMythicalWeapons/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
# 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
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
cp -f "$DLL" "$PLUGINS" || { echo "Error: Failed to copy $DLL"; 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; }
cp -f "$LIB" "$PLUGINS" || { echo "Error: Failed to copy $LIB"; exit 1; }
cp -f "$BUN" "$PLUGINS" || { echo "Error: Failed to copy $BUN"; exit 1; }
ZIPDESTINATION="../bin/Release/ChebsMythicalWeapons.$VERSION.zip"
cd "$PLUGINS/.."
if [ ! -z "$VERSION" ]; then
VERSION=".$VERSION"
fi
zip -r "$ZIPDESTINATION" .