-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish.sh
executable file
·116 lines (97 loc) · 2.14 KB
/
publish.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#!/bin/bash
#
# publish.sh
# Deploy GameSDK modifications to Miscreated Workshop.
#
# Copyright 2022, Marc S. Brooks (https://mbrooks.info)
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license.php
#
# Dependencies:
# steamcmd
# git
# 7za
#
TMPDIR=$PWD/tmp
#
# Parse script arguments.
#
argc=$@
argv=0
for value in $argc; do
case $argv in
'--username')
username=$value
;;
'--password')
password=$value
;;
'--workshop')
workshop=$value
;;
esac
argv=$value
done
if [[ -z "$username" ]] || [[ -z "$password" ]] || [[ -z "$workshop" ]]; then
cat <<EOT
Usage: publish.sh [--username=] [--password=] [--workshop=] [--public]
Options:
--username : Steam account username.
--password : Steam account password.
--workshop : Workshop name to publish.
--public : Adds workshop to Steam results (optional).
EOT
exit 1
fi
#
# Check dependencies.
#
if [ ! `which steamcmd` ]; then
echo "steamcmd is not installed. Exiting."
exit 1
fi
if [ ! `which git` ]; then
echo "git is not installed. Exiting."
exit 1
fi
if [ ! `which 7za` ]; then
echo "7za is not installed. Exiting."
exit 1
fi
#
# Package the release.
#
package=$PWD/Workshop/$workshop
if [ ! -d "$package" ]; then
echo "Workshop not found. Exiting."
exit 1
fi
mkdir $TMPDIR
git describe --abbrev=0 > $PWD/VERSION
7za a -tzip -mx0 "$TMPDIR/$workshop.pak" @"$package/MANIFEST" LICENSE VERSION
if [ $? != 0 ]; then
exit 1
fi
#
# Create VDF reference.
#
. $package/info.inc
outfile=$PWD/mod.vdf
cat << EOF > $outfile
"workshopitem"
{
"appid" "299740"
"contentfolder" "$TMPDIR"
"previewfile" "$package/preview.png"
"visibility" "$([[ $argv == '--public' ]] && echo '0' || echo '3')"
"title" "$TITLE"
"description" "$DESCRIPTION"
"changenote" "$CHANGENOTE"
"tags" ""
"publishedfileid" "$FILEID"
}
EOF
# Publish the package.
steamcmd +login $username $password +workshop_build_item $outfile +quit
# Cleanup build sources.
rm -rf $PWD/mod.vdf $PWD/VERSION $TMPDIR