forked from m00nl1ght-dev/steam-workshop-deploy
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsteam_deploy.sh
More file actions
executable file
·215 lines (176 loc) · 5.06 KB
/
steam_deploy.sh
File metadata and controls
executable file
·215 lines (176 loc) · 5.06 KB
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
steamdir=${STEAM_HOME:-$HOME/Steam}
# this is relative to the action
contentroot=$(pwd)/$rootPath
manifest_path=$(pwd)/manifest.vdf
echo ""
echo "##########################"
echo "# Calculating Deployment #"
echo "##########################"
echo ""
if [ "$concurrentStaging" == "true" ]; then
stagingPath="$stagingPath/$GITHUB_SHA"
fi
mkdir -p "$stagingPath"
echo "Staging Path: $stagingPath"
if [ -z "$deployIgnore" ]; then
if [ -f "$contentroot/.deployignore" ]; then
deployIgnore="$contentroot/.deployignore"
echo "Using user content root .deployignore at $deployIgnore"
else
deployIgnore=""
echo "no user .deployignore found"
fi
else
# Make deployIgnore absolute if relative
if [[ ! "$deployIgnore" = /* ]]; then
deployIgnore="$contentroot/$deployIgnore"
fi
echo "Using user supplied deploy ignore file at $deployIgnore"
fi
RSYNC_EXCLUDE_PARAMS=()
if [ "$useBuiltinDeployIgnore" == "true" ]; then
echo "Including built-in deploy ignore"
RSYNC_EXCLUDE_PARAMS+=(--exclude-from=/root/.defaultdeployignore)
else
echo "!!!!!!NOT USING BUILT IN DEPLOY IGNORE FILE!!!!!!"
fi
if [ -n "$deployIgnore" ]; then
echo "Including user deploy ignore file $deployIgnore"
RSYNC_EXCLUDE_PARAMS+=(--exclude-from="$deployIgnore")
fi
echo "# BuildIgnore Start #"
if [ "$useBuiltinDeployIgnore" = "true" ]; then
cat /root/.defaultdeployignore || true
fi
echo ""
if [ -n "$deployIgnore" ]; then
cat "$deployIgnore" || true
fi
echo "# BuildIgnore End #"
echo "Running rsync to package content..."
if [ "$verbosity" != "NORMAL" ]; then #NOTE: Documentation states that valid values are NORMAL and TRACE.
rsync -av "${RSYNC_EXCLUDE_PARAMS[@]}" "$contentroot/" "$stagingPath"
else #assume TRACE
rsync -a "${RSYNC_EXCLUDE_PARAMS[@]}" "$contentroot/" "$stagingPath"
fi
echo ""
echo "#################################"
echo "# Generating Item Manifest #"
echo "#################################"
echo ""
cat << EOF > "manifest.vdf"
"workshopitem"
{
"appid" "$appId"
"publishedfileid" "$itemId"
"contentfolder" "$stagingPath"
"changenote" "$changeNote"
}
EOF
cat manifest.vdf
echo ""
if [ ! -n "$configVdf" ]; then
echo ""
echo "#################################"
echo "# Using SteamGuard TOTP #"
echo "#################################"
echo ""
steamcmd +set_steam_guard_code "$steam_totp" +login "$steam_username" "$steam_password" +quit;
ret=$?
if [ $ret -eq 0 ]; then
echo ""
echo "#################################"
echo "# Successful login #"
echo "#################################"
echo ""
else
echo ""
echo "#################################"
echo "# FAILED login #"
echo "#################################"
echo ""
echo "Exit code: $ret"
exit $ret
fi
else
if [ ! -n "$configVdf" ]; then
echo "Config VDF input is missing or incomplete! Cannot proceed."
exit 1
fi
steam_totp="INVALID"
echo ""
echo "#################################"
echo "# Copying SteamGuard Files #"
echo "#################################"
echo ""
echo "Steam is installed in: $steamdir"
mkdir -p "$steamdir/config"
echo "Copying $steamdir/config/config.vdf..."
echo "$configVdf" > "$steamdir/config/config.vdf"
chmod 777 "$steamdir/config/config.vdf"
echo "Finished Copying SteamGuard Files!"
echo ""
echo ""
echo "#################################"
echo "# Test login #"
echo "#################################"
echo ""
steamcmd +login "$steam_username" +quit;
ret=$?
if [ $ret -eq 0 ]; then
echo ""
echo "#################################"
echo "# Successful login #"
echo "#################################"
echo ""
else
echo ""
echo "#################################"
echo "# FAILED login #"
echo "#################################"
echo ""
echo "Exit code: $ret"
exit $ret
fi
fi
echo ""
echo "#################################"
echo "# Uploading item #"
echo "#################################"
echo ""
steamcmd +login "$steam_username" +workshop_build_item "$manifest_path" +quit || (
echo ""
echo "#################################"
echo "# Errors #"
echo "#################################"
echo ""
echo "Listing current folder and root path"
echo ""
ls -alh
echo ""
ls -alh "$rootPath" || true
echo ""
echo "Listing logs folder:"
echo ""
ls -Ralph "$steamdir/logs/"
for f in "$steamdir"/logs/*; do
if [ -e "$f" ]; then
echo "######## $f"
cat "$f"
echo
fi
done
echo ""
echo "Displaying error log"
echo ""
cat "$steamdir/logs/stderr.txt"
echo ""
echo "Displaying bootstrapper log"
echo ""
cat "$steamdir/logs/bootstrap_log.txt"
exit 1
)
echo "manifest=${manifest_path}" >> $GITHUB_OUTPUT