gpt4 book ai didi

azure - 在非交互式环境中验证和使用 Firebase

转载 作者:行者123 更新时间:2023-12-03 00:41:24 25 4
gpt4 key购买 nike

我使用 Android 移动应用程序,其源代码在 Azure 中维护。我想自动化构建过程并上传 Firebase App Distribution 中的 .apk 文件,按要求。

我用了Azure Pipeline自动化构建过程。我正在使用 .yml文件以自动化该过程。能够生成 .apk 文件。我需要将其上传到 Firebase。

关注了一些博客,最终得到了需要在我的 .yml 文件中编写的以下代码

- script: |
cd functions
npm init --yes
npm install -g firebase-tools
npm install
firebase login --interactive
firebase appdistribution:distribute --app APP_ID --release-notes "My first distribution" --testers "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0a727370624a6d676b636624696567" rel="noreferrer noopener nofollow">[email protected]</a>" $(build.artifactStagingDirectory)$(Build.ArtifactStagingDirectory)/android-devops.apk
displayName: 'npm install and deploy'

这样,无法登录 Firebase,因为运行时不会有交互。 Azure 在运行作业时完全自动化。如果我在命令提示符中使用这些命令,它会打开 firebase 登录页面并在登录时获得身份验证。之后,appdistribution:distribute 命令将应用程序成功上传到 Firebase。但我需要在 Azure Devops Pipeline 中自动化此过程,其中不会有任何交互。

最佳答案

请先尝试生成身份验证 token ,然后使用以下两个选项之一:

  • 将 token 存储为环境变量 FIREBASE_TOKEN。你的系统将自动使用该 token 。
  • 在 CI 中使用 --token 标志运行所有 firebase 命令系统。

enter image description here

https://firebase.google.com/docs/cli/#command_reference

关于azure - 在非交互式环境中验证和使用 Firebase,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61444504/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com