如何使用 Azure Devops 自动化 AppCenter CodePush 发布?

问题描述 投票:0回答:0

目标是通过经典编辑器利用 azure devops 中 appcenter 的 codepush 功能,为 react-native 应用程序发布 JS bundle。我尝试了两种方法,一种使用特色“Codepush Release”市场任务,另一种使用自定义 bash 脚本

我已经成功地从本地机器的命令行使用 codepush,对这些任务中的选项使用相同的值

来自市场的 codepush 特定任务挂起,运行 60 分钟直到超时,然后取消。没有正当理由这应该需要 60 分钟,所以这里不知道

自定义 bash 脚本如下所示:

npm i  -g appcenter-cli @react-native-community/cli --legacy-peer-deps

#Get target binary from codepush-config.json
TARGET_BINARY=$(cat ./codepush-config.json | grep -o '"targetBinary": "[^"]*"' | cut -d'"' -f4)


#Run codepush release command using target binary and access token from azure ENV variable
appcenter codepush release-react -a Dev-Mobile/App-iOS -d Staging -t $TARGET_BINARY --token $(APPCENTER_iOS_API_TOKEN)

但是这种方法失败并出现此错误:

Error: Cannot find module '/Users/runner/work/1/s/node_modules/.bin/react-native'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
    at Module._load (node:internal/modules/cjs/loader:920:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

我也尝试过显式安装 react-native,但没有效果。似乎 codepush 的

release-react
命令在幕后没有使用
npx react-native bundle
?有什么建议吗?

react-native azure visual-studio-app-center react-native-code-push
© www.soinside.com 2019 - 2024. All rights reserved.