azure - 在非交互式环境中验证和使用 Firebase
问题描述
我使用 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 "xyzh@gmail.com" $(build.artifactStagingDirectory)$(Build.ArtifactStagingDirectory)/android-devops.apk
displayName: 'npm install and deploy'
有了这个,无法登录到firebase,因为运行时不会有交互。Azure 在运行作业时完全自动化。如果我在命令提示符下使用这些命令,它会打开 firebase 登录页面并在登录时获得身份验证。在该appdistribution:distribute
命令成功将应用程序上传到 Firebase 之后。但我需要在 Azure Devops Pipeline 中自动执行此过程,不会有任何交互。
解决方案
请先尝试生成身份验证令牌,然后使用以下两个选项之一:
- 将令牌存储为环境变量 FIREBASE_TOKEN。您的系统将自动使用该令牌。
firebase
在 CI 系统中运行带有 --token 标志的所有命令。
推荐阅读
- wordpress - woocommerce - 在查看订单页面中显示产品
- javascript - 如果传递不同的参数,为什么 console.log 会得到不同的结果?
- android - 可绘制合身
视图的宽度,同时保持纵横比 - java - libgdx FrameBuffer 是如何工作的
- jquery - 通过键盘操作从 textarea 提交表单的快捷方式
- http - 如何在 Go 中使用不记名令牌发出请求
- python - apa102 LED 亮度控制
- python - python中的终端命令不起作用
- python - 操作类实例
- amazon-web-services - Lambda + API Gateway /**/* 路由?