Skip to content

Commit

Permalink
Refactor for steam MFA changes #56 (#57)
Browse files Browse the repository at this point in the history
* Update steam_deploy.sh

Bypass ssfnFileName handling

* Update steam_deploy.sh

* remove defunct inputs; clean up deploy script; update docs for vdf option

* adding missing vdf readme updates
  • Loading branch information
b2ku committed Jun 1, 2023
1 parent 6e43716 commit 26412a2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 39 deletions.
26 changes: 8 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,8 @@ jobs:
steps:
- uses: game-ci/steam-deploy@v2
with:
username: ${{ secrets.STEAM_USERNAME }}
password: ${{ secrets.STEAM_PASSWORD }}
configVdf: ${{ secrets.STEAM_CONFIG_VDF}}
ssfnFileName: ${{ secrets.STEAM_SSFN_FILE_NAME }}
ssfnFileContents: ${{ secrets.STEAM_SSFN_FILE_CONTENTS }}
username: ${{ secrets.STEAM_USERNAME }}
configVdf: ${{ secrets.STEAM_CONFIG_VDF}}
appId: 1234560
buildDescription: v1.2.3
rootPath: build
Expand All @@ -66,8 +63,7 @@ jobs:
shared_secret: ${{ secrets.STEAM_SHARED_SECRET }}
- uses: game-ci/steam-deploy@v2
with:
username: ${{ secrets.STEAM_USERNAME }}
password: ${{ secrets.STEAM_PASSWORD }}
username: ${{ secrets.STEAM_USERNAME }}
totp: ${{ steps.steam-totp.outputs.code }}
appId: 1234560
buildDescription: v1.2.3
Expand All @@ -83,26 +79,20 @@ jobs:

The username of the Steam Build Account that you created in setup step 1.

#### password

The password of the Steam Build Account that you created in setup step 1.

#### totp

Deploying to Steam using TOTP. If this is not passed, `configVdf`, `ssfnFileName`, and `ssfnFileContents` are required.
Deploying to Steam using TOTP. If this is not passed, `configVdf` is required.

#### configVdf, ssfnFileName, and ssfnFileContents
#### configVdf

Deploying to Steam requires using Multi-Factor Authentication (MFA) through Steam Guard unless `totp` is passed.
This means that simply using username and password isn't enough to authenticate with Steam.
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:
However, it is possible to go through the MFA process only once by setting up GitHub Secrets for configVdf with these steps:
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.
1. Try to login with `steamcmd +login <username> <password> +quit`, which may prompt for the MFA code. If so, type in the MFA code that was emailed to your builder account's email address.
1. Validate that the MFA process is complete by running `steamcmd +login <username> <password> +quit` again. It should not ask for the MFA code again.
1. Validate that the MFA process is complete by running `steamcmd +login <username> +quit` again. It should not ask for the MFA code again.
1. The folder from which you run `steamcmd` will now contain an updated `config/config.vdf` file. Use `cat config/config.vdf | base64 > config_base64.txt` to encode the file. Copy the contents of `config_base64.txt` to a GitHub Secret `STEAM_CONFIG_VDF`.
1. Find the SSFN file, depending on your platform. **Windows**: The `steamcmd` folder will also contain two files of which the names look like `ssfn<numbers>`. **One of them is a hidden file**. [Find that hidden file](https://support.microsoft.com/en-us/windows/view-hidden-files-and-folders-in-windows-97fbc472-c603-9d90-91d0-1166d1d9f4b5) and use that hidden file as the correct SSFN file for the following steps. **Linux**: The SSFN file will be in the `steamcmd` folder. **Mac**: The SSFN will be at `~/Library/Application\ Support/Steam/`.
1. Copy the name of the SSFN file to a GitHub Secret `STEAM_SSFN_FILE_NAME`.
1. Use `cat <ssfnFileName> | base64 > ssfn_base64.txt` to encode the contents of the SSFN file. Copy the encoded contents inside `ssfn_base64.txt` to a GitHub Secret called `STEAM_SSFN_FILE_CONTENTS`.
1. `If:` when running the action you recieve another MFA code via email, run `steamcmd +set_steam_guard_code <code>` on your local machine and repeat the `config.vdf` encoding and replace secret `STEAM_CONFIG_VDF` with its contents.

#### appId

Expand Down
14 changes: 2 additions & 12 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,13 @@ inputs:
username:
required: true
default: ''
description: 'The username of your builder account.'
password:
required: true
default: ''
description: 'The password of your builder account.'
description: 'The username of your builder account.'
totp:
required: false
description: 'The TOTP to use for login. If set, `configVdf`, `ssfnFileName`, and `ssfnFileContents` will be ignored.'
configVdf:
required: false
description: 'The contents of STEAM_HOME/config/config.vdf. Required if `totp` is not set.'
ssfnFileName:
required: false
description: 'The basename of the STEAM_HOME/ssfn file. Required if `totp` is not set.'
ssfnFileContents:
required: false
description: 'The contents of the file at STEAM_HOME/ssfnFileName. Required if `totp` is not set.'
description: 'The contents of STEAM_HOME/config/config.vdf. Required if `totp` is not set.'
appId:
required: true
default: ''
Expand Down
14 changes: 5 additions & 9 deletions steam_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ if [ -n "$steam_totp" ]; then
echo "# Using SteamGuard TOTP #"
echo "#################################"
echo ""
else
if [ ! -n "$configVdf" ] || [ ! -n "$ssfnFileName" ] || [ ! -n "$ssfnFileContents" ]; then
echo "MFA inputs are missing or incomplete! Cannot proceed."
else
if [ ! -n "$configVdf" ]; then
echo "Config VDF input is missing or incomplete! Cannot proceed."
exit 1
fi

Expand All @@ -110,10 +110,6 @@ else
echo "$configVdf" | base64 -d > "$steamdir/config/config.vdf"
chmod 777 "$steamdir/config/config.vdf"

echo "Copying $steamdir/ssfn..."
echo "$ssfnFileContents" | base64 -d > "$steamdir/$ssfnFileName"
chmod 777 "$steamdir/$ssfnFileName"

echo "Finished Copying SteamGuard Files!"
echo ""
fi
Expand All @@ -124,7 +120,7 @@ echo "# Test login #"
echo "#################################"
echo ""

steamcmd +set_steam_guard_code "$steam_totp" +login "$steam_username" "$steam_password" +quit;
steamcmd +set_steam_guard_code "$steam_totp" +login "$steam_username" +quit;

ret=$?
if [ $ret -eq 0 ]; then
Expand All @@ -150,7 +146,7 @@ echo "# Uploading build #"
echo "#################################"
echo ""

steamcmd +login "$steam_username" "$steam_password" +run_app_build "$manifest_path" +quit || (
steamcmd +login "$steam_username" +run_app_build "$manifest_path" +quit || (
echo ""
echo "#################################"
echo "# Errors #"
Expand Down

0 comments on commit 26412a2

Please sign in to comment.