Skip to content

Commit e37b353

Browse files
authored
feat(inputs): totp support (#47)
1 parent be98464 commit e37b353

File tree

3 files changed

+71
-26
lines changed

3 files changed

+71
-26
lines changed

README.md

+32-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ In order to configure this action, configure a step that looks like the followin
3030

3131
_(The parameters are explained below)_
3232

33+
Option A. Using MFA files
34+
3335
```yaml
3436
jobs:
3537
deployToSteam:
@@ -50,6 +52,31 @@ jobs:
5052
releaseBranch: prerelease
5153
```
5254
55+
Option B. Using TOTP
56+
57+
```yaml
58+
jobs:
59+
deployToSteam:
60+
runs-on: ubuntu-latest
61+
steps:
62+
- uses: CyberAndrii/steam-totp@v1
63+
name: Generate TOTP
64+
id: steam-totp
65+
with:
66+
shared_secret: ${{ secrets.STEAM_SHARED_SECRET }}
67+
- uses: game-ci/steam-deploy@v1
68+
with:
69+
username: ${{ secrets.STEAM_USERNAME }}
70+
password: ${{ secrets.STEAM_PASSWORD }}
71+
totp: ${{ steps.steam-totp.outputs.code }}
72+
appId: 1234560
73+
buildDescription: v1.2.3
74+
rootPath: build
75+
depot1Path: StandaloneWindows64
76+
depot2Path: StandaloneLinux64
77+
releaseBranch: prerelease
78+
```
79+
5380
## Configuration
5481
5582
#### username
@@ -60,9 +87,13 @@ The username of the Steam Build Account that you created in setup step 1.
6087
6188
The password of the Steam Build Account that you created in setup step 1.
6289
90+
#### totp
91+
92+
Deploying to Steam using TOTP. If this is not passed, `configVdf`, `ssfnFileName`, and `ssfnFileContents` are required.
93+
6394
#### configVdf, ssfnFileName, and ssfnFileContents
6495

65-
Deploying to Steam requires using Multi-Factor Authentication (MFA) through Steam Guard.
96+
Deploying to Steam requires using Multi-Factor Authentication (MFA) through Steam Guard unless `totp` is passed.
6697
This means that simply using username and password isn't enough to authenticate with Steam.
6798
However, it is possible to go through the MFA process only once by setting up GitHub Secrets for configVdf, ssfnFileName, and ssfnFileContents with these steps:
6899
1. Install [Valve's offical steamcmd](https://partner.steamgames.com/doc/sdk/uploading#1) on your local machine. All following steps will also be done on your local machine.

action.yml

+10-9
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ inputs:
1010
required: true
1111
default: ''
1212
description: 'The password of your builder account.'
13+
totp:
14+
required: false
15+
description: 'The TOTP to use for login. If set, `configVdf`, `ssfnFileName`, and `ssfnFileContents` will be ignored.'
1316
configVdf:
14-
required: true
15-
default: ''
16-
description: 'The contents of STEAM_HOME/config/config.vdf.'
17+
required: false
18+
description: 'The contents of STEAM_HOME/config/config.vdf. Required if `totp` is not set.'
1719
ssfnFileName:
18-
required: true
19-
default: ''
20-
description: 'The basename of the STEAM_HOME/ssfn file.'
20+
required: false
21+
description: 'The basename of the STEAM_HOME/ssfn file. Required if `totp` is not set.'
2122
ssfnFileContents:
22-
required: true
23-
default: ''
24-
description: 'The contents of the file at STEAM_HOME/ssfnFileName.'
23+
required: false
24+
description: 'The contents of the file at STEAM_HOME/ssfnFileName. Required if `totp` is not set.'
2525
appId:
2626
required: true
2727
default: ''
@@ -80,6 +80,7 @@ runs:
8080
STEAM_CMD: ${{ steps.setup-steamcmd.outputs.executable }}
8181
steam_username: ${{ inputs.username }}
8282
steam_password: ${{ inputs.password }}
83+
steam_totp: ${{ inputs.totp }}
8384
configVdf: ${{ inputs.configVdf }}
8485
ssfnFileName: ${{ inputs.ssfnFileName }}
8586
ssfnFileContents: ${{ inputs.ssfnFileContents }}

steam_deploy.sh

+29-16
Original file line numberDiff line numberDiff line change
@@ -86,34 +86,47 @@ EOF
8686
cat manifest.vdf
8787
echo ""
8888

89-
echo ""
90-
echo "#################################"
91-
echo "# Copying SteamGuard Files #"
92-
echo "#################################"
93-
echo ""
89+
if [ -n "$steam_totp" ]; then
90+
echo ""
91+
echo "#################################"
92+
echo "# Using SteamGuard TOTP #"
93+
echo "#################################"
94+
echo ""
95+
else
96+
if [ ! -n "$configVdf" ] || [ ! -n "$ssfnFileName" ] || [ ! -n "$ssfnFileContents" ]; then
97+
echo "MFA inputs are missing or incomplete! Cannot proceed."
98+
exit 1
99+
fi
94100

95-
echo "Steam is installed in: $steamdir"
101+
echo ""
102+
echo "#################################"
103+
echo "# Copying SteamGuard Files #"
104+
echo "#################################"
105+
echo ""
96106

97-
mkdir -p "$steamdir/config"
107+
echo "Steam is installed in: $steamdir"
98108

99-
echo "Copying $steamdir/config/config.vdf..."
100-
echo "$configVdf" | base64 -d > "$steamdir/config/config.vdf"
101-
chmod 777 "$steamdir/config/config.vdf"
109+
mkdir -p "$steamdir/config"
102110

103-
echo "Copying $steamdir/ssfn..."
104-
echo "$ssfnFileContents" | base64 -d > "$steamdir/$ssfnFileName"
105-
chmod 777 "$steamdir/$ssfnFileName"
111+
echo "Copying $steamdir/config/config.vdf..."
112+
echo "$configVdf" | base64 -d > "$steamdir/config/config.vdf"
113+
chmod 777 "$steamdir/config/config.vdf"
106114

107-
echo "Finished Copying SteamGuard Files!"
108-
echo ""
115+
echo "Copying $steamdir/ssfn..."
116+
echo "$ssfnFileContents" | base64 -d > "$steamdir/$ssfnFileName"
117+
chmod 777 "$steamdir/$ssfnFileName"
118+
119+
echo "Finished Copying SteamGuard Files!"
120+
echo ""
121+
fi
109122

110123
echo ""
111124
echo "#################################"
112125
echo "# Uploading build #"
113126
echo "#################################"
114127
echo ""
115128

116-
$STEAM_CMD +login "$steam_username" "$steam_password" +run_app_build $manifest_path +quit || (
129+
$STEAM_CMD +login "$steam_username" "$steam_password" "$steam_totp" +run_app_build $manifest_path +quit || (
117130
echo ""
118131
echo "#################################"
119132
echo "# Errors #"

0 commit comments

Comments
 (0)