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

Cannot execute `steam-deploy` twice in the same CI job

Open soundasleep opened this issue 1 year ago • 5 comments

Bug description

It seems that if you try to push to two branches in the same CI job, this action will fail in the second step with:

mkdir: cannot create directory ‘BuildOutput’: File exists

My guess is that at https://github.com/game-ci/steam-deploy/blob/main/steam_deploy.sh#L10 it's creating a new BuildOutput directory but it's never deleted.

How to reproduce

    - name: Deploy to Steam (branch1)
      uses: game-ci/steam-deploy@v3
      with:
        username: ...
        configVdf: ...
        appId: ...
        buildDescription: todo
        rootPath: desktop/build
        depot2Path: package/
        releaseBranch: branch1
    - name: Deploy to Steam (branch2)
      uses: game-ci/steam-deploy@v3
      with:
        username: ...
        configVdf: ...
        appId: ...
        buildDescription: todo
        rootPath: desktop/build
        depot2Path: package/
        releaseBranch: branch2

Expected behavior

It should be possible to push the same build to two Steam branches within the same CI job.

Additional details

Potential workarounds:

  • Maybe steam-deploy can rm -rf BuildOutput once the build has successfully uploaded
  • Or the BuildOutput directory name is randomly generated per build
  • Another workaround is probably running two CI jobs concurrently, one for each Steam branch, but https://github.com/game-ci/steam-deploy/issues/62#issuecomment-2409083082 reported that it may not be possible to upload two Steam branches at the same time

soundasleep avatar Dec 01 '24 23:12 soundasleep

Did you try your suggestion of removing BuildOutput in between the steps?

If it resolves the issue we could maybe then add it to the start of the action.

webbertakken avatar Dec 02 '24 00:12 webbertakken

Yes! I had to do a bit of chowning first, otherwise the directory couldn't be deleted (it's created by root:root?) but this is my workaround:

    - name: Deploy to Steam (branch1)
      uses: game-ci/steam-deploy@v3
      with:
        username: ...
        configVdf: ...
        appId: ...
        buildDescription: todo
        rootPath: desktop/build
        depot2Path: package/
        releaseBranch: branch1
    - name: Delete BuildOutput folder
      run: |
        whoami
        ls -la
        ls -la BuildOutput
        sudo chown -R $USER:$USER BuildOutput
        ls -la
        ls -la BuildOutput
        rm -rf BuildOutput
    - name: Deploy to Steam (branch2)
      uses: game-ci/steam-deploy@v3
      with:
        username: ...
        configVdf: ...
        appId: ...
        buildDescription: todo
        rootPath: desktop/build
        depot2Path: package/
        releaseBranch: branch2

soundasleep avatar Dec 02 '24 00:12 soundasleep

I also just ran into this situation and came here to see if it had been posted. I simply added a step to my build.yml, but ideally the script would cleanup after itself, or perhaps use mkdir -p BuildOutput, or take the build output location as a parameter.

mikecoker avatar Mar 11 '25 14:03 mikecoker

This is also an issue for self-hosted runners, since BuildOutput survives until the next CI run and fails when checking out a new version of the code (since the owner of BuildOutput is root and can't be deleted).

unity-builder fixes this with a runAsHostUser option, so maybe something like this here would work?

Ripazhakgggdkp avatar Aug 06 '25 21:08 Ripazhakgggdkp

A single line should be enough as a workaround:

- name: Delete BuildOutput folder
  run: sudo rm -rf BuildOutput

OndrejSpanel avatar Sep 02 '25 14:09 OndrejSpanel