steam-deploy icon indicating copy to clipboard operation
steam-deploy copied to clipboard

Add custom rules to depot

Open stalkerg opened this issue 2 years ago • 3 comments

Depot file it's not just folder with a game, it's have much more important rules like FileProperties or FileExclusion how can I add a such options to generated depot?

stalkerg avatar Dec 10 '23 14:12 stalkerg

Good shout!

You'd have to extend the action to support this kind of functionality. This repo is open for everyone to contribute to and makes for a stable central logic that everyone can use.

webbertakken avatar Dec 10 '23 14:12 webbertakken

If I understand correctly, the question can be summarized like this:

How can I customize the Github Actions parameters to add options like FileProperties or FileExclusion to the Steam depot using steam-deploy action to support game folders with special configurations?

I'd say it's important to have a good understanding of how github actions work first. Here's a great starting point:

https://docs.github.com/en/actions/creating-actions

The steps required to customize and add FileProperties and FileExclusion inputs to the action should look like this:

  1. Fork the repository

  2. Add new inputs to your fork's actions.yml. Would probably look something like this (draft):

    inputs:
      ...
      fileProperties:
        description: 'Additional file properties to apply.'
        required: false
      fileExclusion:
        description: 'Patterns of files to exclude.'
        required: false
    
  3. Add desired logic to steam_deploy.sh.

    Here's an untested draft
    #!/bin/bash
    set -euo pipefail
    IFS=$'\n\t'
    
    steamdir=${STEAM_HOME:-$HOME/Steam}
    contentroot=$(pwd)/$rootPath
    
    mkdir BuildOutput
    manifest_path=$(pwd)/manifest.vdf
    
    echo ""
    echo "#################################"
    echo "#   Generating Depot Manifests  #"
    echo "#################################"
    echo ""
    
    if [ -n "$firstDepotIdOverride" ]; then
      firstDepotId=$firstDepotIdOverride
    else
      firstDepotId=$((appId + 1))
    fi
    
    i=1;
    export DEPOTS="\n  "
    until [ $i -gt 9 ]; do
      eval "currentDepotPath=\$depot${i}Path"
      if [ -n "$currentDepotPath" ]; then
        currentDepot=$((firstDepotId + i - 1))
    
        echo ""
        echo "Adding depot${currentDepot}.vdf ..."
        echo ""
        export DEPOTS="$DEPOTS  \"$currentDepot\" \"depot${currentDepot}.vdf\"\n  "
    
        echo "\"DepotBuildConfig\"" > "depot${currentDepot}.vdf"
        echo "{" >> "depot${currentDepot}.vdf"
        echo "  \"DepotID\" \"$currentDepot\"" >> "depot${currentDepot}.vdf"
        echo "  \"FileMapping\"" >> "depot${currentDepot}.vdf"
        echo "  {" >> "depot${currentDepot}.vdf"
        echo "    \"LocalPath\" \"./$currentDepotPath/*\"" >> "depot${currentDepot}.vdf"
        echo "    \"DepotPath\" \".\"" >> "depot${currentDepot}.vdf"
        echo "    \"recursive\" \"1\"" >> "depot${currentDepot}.vdf"
        echo "  }" >> "depot${currentDepot}.vdf"
    
        # Handling File Exclusions
        if [ -n "${fileExclusion:-}" ]; then
          for exclusion in $fileExclusion; do
            echo "  \"FileExclusion\" \"$exclusion\"" >> "depot${currentDepot}.vdf"
          done
        fi
    
        # Handling File Properties
        if [ -n "${fileProperties:-}" ]; then
          echo "  \"FileProperties\"" >> "depot${currentDepot}.vdf"
          echo "  {" >> "depot${currentDepot}.vdf"
          for prop in $fileProperties; do
            echo "    \"$prop\"" >> "depot${currentDepot}.vdf"
          done
          echo "  }" >> "depot${currentDepot}.vdf"
        fi
    
        echo "}" >> "depot${currentDepot}.vdf"
    
        cat depot${currentDepot}.vdf
        echo ""
      fi
    
      i=$((i+1))
    done
    
    # ... Rest of the script remains unchanged ...
    
  4. Push changes to your fork

  5. To test these changes, update your unity project's workflow file to point to your steam-deploy fork. It should look something like your_github_username/steam-deploy@master (replace master with your branch or tag where you added the changes).

If you plan to contribute changes back to the repository with a pull-request, make sure you follow the contributing guidelines.

Let us know if you have questions 🙏

GabLeRoux avatar Dec 11 '23 00:12 GabLeRoux

Thanks everyone, I have no issue making it in my fork, I just put it here to keep track. I will check @GabLeRoux solution and if it works and usefully I will come back with PR.

stalkerg avatar Dec 11 '23 00:12 stalkerg