I'm trying to create a shell script that runs only on the prod versions of the cloud build targets. Its goal is to replace the bundle id and firebase config files for the production values. I'm using the $WORKSPACE environment variable to achieve some basic file manipulation using bash. It seems to be working fine for the android build, but it's erroring for the ios build.
Here's the simple script:
#!/bin/sh
echo $WORKSPACE
mv $WORKSPACE/client/Assets/google-services.json_prod $WORKSPACE/client/Assets/google-service.json
mv $WORKSPACE/client/Assets/GoogleService-Info.plist_prod $WORKSPACE/client/Assets/GoogleService-Info.plist
sed -i 's/Android: redacted/Android: redacted/g' $WORKSPACE/client/ProjectSettings/ProjectSettings.asset
sed -i 's/iPhone: redacted/iPhone: hredacted/g' $WORKSPACE/client/ProjectSettings/ProjectSettings.asset
sed -i 's/overrideDefaultApplicationIdentifier: 0/overrideDefaultApplicationIdentifier: 1/g' $WORKSPACE/client/ProjectSettings/ProjectSettings.asset
sed -i 's/productName: redacted: redacted/g' $WORKSPACE/client/ProjectSettings/ProjectSettings.asset
On ios build, here's the output:
Executing Pre-Build Script at Assets/Shell/pre_build.sh
73: /BUILD_PATH/unity_4b7b6722eef28df6b99d.baseball-rivalszk5qkewb
74: sed: orkspace/workspace/unity_4b7b6722eef28df6b99d.baseball-rivalszk5qkewb/client/ProjectSettings/ProjectSettings.asset: No such file or directory
75: sed: orkspace/workspace/unity_4b7b6722eef28df6b99d.baseball-rivalszk5qkewb/client/ProjectSettings/ProjectSettings.asset: No such file or directory
76: sed: orkspace/workspace/unity_4b7b6722eef28df6b99d.baseball-rivalszk5qkewb/client/ProjectSettings/ProjectSettings.asset: No such file or directory
77: sed: orkspace/workspace/unity_4b7b6722eef28df6b99d.baseball-rivalszk5qkewb/client/ProjectSettings/ProjectSettings.asset: No such file or directory
78: ! build of 'ios-prod' failed. Pre-Build script exited with status 1. Aborting.
CodePudding user response:
I ended up removing the $WORKSPACE variable from the script and using only a relative path like this: ./client/Assets...
and it worked.