[英]Deploying firebase cloud functions using github actions
I'm trying to deploy my firebase cloud functions app using github actions:我正在尝试使用 github 操作部署我的 firebase 云函数应用程序:
name: Deploy
'on':
push:
branches:
- main
jobs:
deploy_to_production:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install dependencies
run: cd functions/ && npm install
- name: deploy to production
uses: w9jds/firebase-action@master
with:
args: deploy --only functions
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
The step "deploy to production" is not successful. “部署到生产”步骤不成功。 I activate debug mode and I don't actually receive any useful information:
我激活了调试模式,但实际上并没有收到任何有用的信息:
##[debug]Evaluating: secrets.FIREBASE_TOKEN
##[debug]Evaluating Index:
##[debug]..Evaluating secrets:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'FIREBASE_TOKEN'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Evaluating condition for step: 'deploy to production'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: deploy to production
##[debug]Loading inputs
##[debug]Loading env
Run w9jds/firebase-action@master
with:
args: deploy --only functions
env:
FIREBASE_TOKEN: ***
/usr/bin/docker run --name w9jdsfirebaseactionv212_2c5197 --label 08450d --workdir /github/workspace --rm -e FIREBASE_TOKEN -e INPUT_ARGS -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e GITHUB_STEP_SUMMARY -e RUNNER_DEBUG -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/personalsite-backend/personalsite-backend":"/github/workspace" w9jds/firebase-action:v2.1.2 deploy --only functions
##[debug]Docker Action run completed with exit code 2
##[debug]Finishing: deploy to production
Am I missing something?我错过了什么吗?
Note: Locally I can deploy without any problem.注意:在本地我可以毫无问题地部署。
By using w9jds/firebase-action
, there's a known issue wherein if you use uses: w9jds/firebase-action@master
, it tries to store what the CLI spits out and if it errors out and ends the action before it can echo it this might stop it from printing out the response.通过使用
w9jds/firebase-action
,有一个已知问题,如果您使用uses: w9jds/firebase-action@master
,它会尝试存储 CLI 输出的内容,如果它出错并在它可以回显之前结束操作可能会阻止它打印出响应。 More information from the repository owner here . 此处来自存储库所有者的更多信息。
Starting with version v2.1.2
, you must replace this line:从版本
v2.1.2
开始,您必须替换此行:
uses: w9jds/firebase-action@master
to this:对此:
uses: docker://w9jds/firebase-action:master
More information here .更多信息在这里。
Moreover, there is also an alternate solution to this by using actions/checkout
instead.此外,还有一个替代解决方案,即使用
actions/checkout
代替。 See yaml
configuration below:看下面
yaml
配置:
name: Deploy to Firebase Functions via github action
"on":
push:
branches:
- main
env:
CI: false
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download deps
working-directory: functions
run: npm install
- name: Deploy
run: npx firebase-tools deploy
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
Note: I've used actions/checkout@v2
on the sample yaml above, but v3
is now available.注意:我在上面的示例 yaml 上使用了
actions/checkout@v2
,但现在可以使用v3
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.