-
Notifications
You must be signed in to change notification settings - Fork 3
/
entrypoint.sh
47 lines (40 loc) · 1.3 KB
/
entrypoint.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
#!/bin/bash
if [[ -z "${STEAM_USERNAME}" ]]; then
echo "Environment variable STEAM_USERNAME is required but not provided."
exit 1
else
username="${STEAM_USERNAME}"
fi
if [[ -z "${STEAM_PASSWORD}" ]]; then
echo "Environment variable STEAM_PASSWORD is required but not provided."
exit 1
else
password="${STEAM_PASSWORD}"
fi
cat << EOF > /home/steam/workshop.vdf
"workshopitem"
{
"appid" "${INPUT_APPID}"
"contentfolder" "${GITHUB_WORKSPACE}/${INPUT_PATH}"
"changenote" "${INPUT_CHANGENOTE}"
"publishedfileid" "${INPUT_ITEMID}"
}
EOF
echo "$(cat /home/steam/workshop.vdf)"
if [[ -z "${STEAM_TFASEED}" ]]; then
/home/steam/steamcmd/steamcmd.sh +@ShutdownOnFailedCommand 1 +login ${STEAM_USERNAME} ${STEAM_PASSWORD} +workshop_build_item /home/steam/workshop.vdf +quit
else
code=$(/home/steam/steamcmd-2fa --username ${STEAM_USERNAME} --password ${STEAM_PASSWORD} --seed ${STEAM_TFASEED} --code-only)
if [[ $? -ne 0 ]]; then
exit 1
fi
/home/steam/steamcmd/steamcmd.sh +@ShutdownOnFailedCommand 1 +login ${STEAM_USERNAME} ${STEAM_PASSWORD} $code +workshop_build_item /home/steam/workshop.vdf +quit
fi
[ $? -eq 0 ] && exit 0 || (
echo stderr
echo "$(cat /home/steam/Steam/logs/stderr.txt)"
echo
echo workshop_log
echo "$(cat /home/steam/Steam/logs/workshop_log.txt)"
exit 1
)