Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom rules to depot #67

Open
stalkerg opened this issue Dec 10, 2023 · 3 comments
Open

Add custom rules to depot #67

stalkerg opened this issue Dec 10, 2023 · 3 comments

Comments

@stalkerg
Copy link

stalkerg commented Dec 10, 2023

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?

@webbertakken
Copy link
Member

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.

@GabLeRoux
Copy link
Member

GabLeRoux commented Dec 11, 2023

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 🙏

@stalkerg
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants