Cannot execute `steam-deploy` twice in the same CI job
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-deploycanrm -rf BuildOutputonce the build has successfully uploaded - Or the
BuildOutputdirectory 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
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.
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
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.
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?
A single line should be enough as a workaround:
- name: Delete BuildOutput folder
run: sudo rm -rf BuildOutput