unity cloud build bash脚本修改文件,使用$WORKSPACE变量
Unity cloud build bash script to modify files, using the $WORKSPACE variable
我正在尝试创建一个仅在云构建目标的生产版本上运行的 shell 脚本。它的目标是替换生产值的 bundle id 和 firebase 配置文件。我正在使用 $WORKSPACE 环境变量来实现一些使用 bash 的基本文件操作。 android 版本似乎工作正常,但 ios 版本出错。
这是简单的脚本:
#!/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
在 ios 构建中,输出如下:
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.
我最终从脚本中删除了 $WORKSPACE 变量并仅使用这样的相对路径:./client/Assets...
并且有效。
我正在尝试创建一个仅在云构建目标的生产版本上运行的 shell 脚本。它的目标是替换生产值的 bundle id 和 firebase 配置文件。我正在使用 $WORKSPACE 环境变量来实现一些使用 bash 的基本文件操作。 android 版本似乎工作正常,但 ios 版本出错。
这是简单的脚本:
#!/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
在 ios 构建中,输出如下:
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.
我最终从脚本中删除了 $WORKSPACE 变量并仅使用这样的相对路径:./client/Assets...
并且有效。