-
Notifications
You must be signed in to change notification settings - Fork 1
/
release.sh
executable file
·68 lines (51 loc) · 1.66 KB
/
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
#!/usr/bin/env bash
# TODO: Add Makefile.
VERSION="$1"
if [ -z "${VERSION}" ]; then echo "VERSION is not set. Use ./release.sh 0.0.0 stage" >&2; exit 1; fi
STAGE="$2"
if [ -z "${STAGE}" ]; then STAGE="prod"; fi
MOD_NAME="LogExtender"
if [ "${STAGE}" == "test" ]; then MOD_NAME="${MOD_NAME}Test"; fi
RELEASE_NAME="${MOD_NAME}-${VERSION}"
rm -r .tmp/release
mkdir .tmp/release
touch .tmp/release/checksum.txt
function make_release() {
local dir_workshop=".tmp/release/${RELEASE_NAME}"
local dir="${dir_workshop}/Contents/mods/${MOD_NAME}"
mkdir -p "${dir}"
case $STAGE in
test)
cp workshop/test/workshop.txt "${dir_workshop}"
cp workshop/test/mod.info "${dir}"
;;
prod)
cp workshop/workshop.txt "${dir_workshop}"
cp workshop/mod.info "${dir}"
;;
*)
echo "incorrect stage" >&2
exit 1
;;
esac
cp workshop/preview.png "${dir_workshop}/preview.png"
cp workshop/poster.png "${dir}"
cp src -r "${dir}/media"
cp LICENSE "${dir}"
cp README.md "${dir}"
cp CHANGELOG.md "${dir}"
cd "${dir_workshop}/Contents/mods/"
tar -zcvf "../../../${RELEASE_NAME}.tar.gz" "${MOD_NAME}"
zip -r "../../../${RELEASE_NAME}.zip" "${MOD_NAME}"
cd ../../../ && {
md5sum "${RELEASE_NAME}.tar.gz" >> checksum.txt;
md5sum "${RELEASE_NAME}.zip" >> checksum.txt;
cd ../../;
}
}
function install_release() {
rm -r ~/Zomboid/Workshop/"${MOD_NAME}"
cp -r .tmp/release/"${RELEASE_NAME}" ~/Zomboid/Workshop/"${MOD_NAME}"
rm -r .tmp/release/"${RELEASE_NAME}"
}
make_release && install_release