forked from game-ci/steam-deploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
steam_deploy.sh
executable file
·205 lines (177 loc) · 4.65 KB
/
steam_deploy.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
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
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
steamdir=${STEAM_HOME:-$HOME/Steam}
# this is relative to the action
contentroot=$(pwd)/$rootPath
# these are temporary file we create, so in a tmpdir
mkdir -p BuildOutput
manifest_path=$(pwd)/manifest.vdf
echo ""
echo "#################################"
echo "# Generating Depot Manifests #"
echo "#################################"
echo ""
if [ -n "$firstDepotIdOverride" ]; then
firstDepotId=$firstDepotIdOverride
else
# The first depot ID of a standard Steam app is the app's ID plus one
firstDepotId=$((appId + 1))
fi
if [ -n "$depotPaths" ]; then
IFS=',' read -ra depotPaths <<< "$depotPaths"
else
# depotPaths not set, checking depot1Path, depot2Path, ...
depotPaths=()
i=1;
until [ $i -gt 9 ]; do
eval "currentDepotPath=\$depot${i}Path"
if [ -n "$currentDepotPath" ]; then
depotPaths += "$currentDepotPath"
fi
done
fi
export DEPOTS="\n "
for i in "${!depotPaths[@]}"
do
currentDepotPath="${depotPaths[i]}"
# depot1Path uses firstDepotId, depot2Path uses firstDepotId + 1, depot3Path uses firstDepotId + 2...
currentDepot=$((firstDepotId + i))
echo ""
echo "Adding depot${currentDepot}.vdf ..."
echo ""
export DEPOTS="$DEPOTS \"$currentDepot\" \"depot${currentDepot}.vdf\"\n "
cat << EOF > "depot${currentDepot}.vdf"
"DepotBuildConfig"
{
"DepotID" "$currentDepot"
"FileMapping"
{
"LocalPath" "./$currentDepotPath/*"
"DepotPath" "."
"recursive" "1"
}
"FileExclusion" "*.pdb"
"FileExclusion" "**/*_BurstDebugInformation_DoNotShip*"
"FileExclusion" "**/*_BackUpThisFolder_ButDontShipItWithYourGame*"
}
EOF
cat depot${currentDepot}.vdf
echo ""
done
echo ""
echo "#################################"
echo "# Generating App Manifest #"
echo "#################################"
echo ""
cat << EOF > "manifest.vdf"
"appbuild"
{
"appid" "$appId"
"desc" "$buildDescription"
"buildoutput" "BuildOutput"
"contentroot" "$contentroot"
"setlive" "$releaseBranch"
"depots"
{$(echo "$DEPOTS" | sed 's/\\n/\
/g')}
}
EOF
cat manifest.vdf
echo ""
if [ -n "$steam_totp" ]; then
echo ""
echo "#################################"
echo "# Using SteamGuard TOTP #"
echo "#################################"
echo ""
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" | base64 -d > "$steamdir/config/config.vdf"
chmod 777 "$steamdir/config/config.vdf"
echo "Finished Copying SteamGuard Files!"
echo ""
fi
echo ""
echo "#################################"
echo "# Test login #"
echo "#################################"
echo ""
steamcmd +set_steam_guard_code "$steam_totp" +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
echo ""
echo "#################################"
echo "# Uploading build #"
echo "#################################"
echo ""
steamcmd +login "$steam_username" +run_app_build "$manifest_path" +quit || (
echo ""
echo "#################################"
echo "# Errors #"
echo "#################################"
echo ""
echo "Listing current folder and rootpath"
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"
echo ""
echo "#################################"
echo "# Output #"
echo "#################################"
echo ""
ls -Ralph BuildOutput
for f in BuildOutput/*.log; do
echo "######## $f"
cat "$f"
echo
done
exit 1
)
echo "manifest=${manifest_path}" >> $GITHUB_OUTPUT