[英]Firebase Deployment using Github Action
I'm trying to deploy my code using Github's actions to firebase.我正在尝试使用 Github 的操作将我的代码部署到 firebase。
I am receiving this error我收到此错误
success Installed "firebase-tools@7.11.0" with binaries:
- firebase
Done in 12.99s.
/home/runner/work/_temp/30a2b6cb-a097-4d73-ac92-5379d0cc6ccf.sh: line 2: firebase: command not found
my code for deploy is as following我的部署代码如下
deploy:
name: Deploy
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
- name: Download Artifact
uses: actions/download-artifact@v1
with:
name: dist
- name: yarn add firebase-tools
run: |
yarn global add firebase-tools
firebase deploy ${{ secrets.firebase_token }} --only hosting:**** --non-interactive
env:
PROJECT_ID: ****
how can I add firebase-tools globally?如何在全球范围内添加 firebase-tools?
I tried https://github.com/marketplace/actions/github-action-for-firebase我试过https://github.com/marketplace/actions/github-action-for-firebase
But getting Error但得到错误
setting firebase project to ***
Now using project ***
=== Deploying to '***'...
i deploying hosting
✔ Deploy complete!
Project Console: *******************
Error: An unexpected error has occurred.
##[error]Docker run failed with exit code 2
Here is the code for this.这是此代码。
deploy:
name: Deploy
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
- name: Download Artifact
uses: actions/download-artifact@v1
with:
name: dist
- name: Deploy to Firebase
uses: w9jds/firebase-action@master
with:
args: deploy --only hosting:****
env:
FIREBASE_TOKEN: ${{ secrets.firebase_token }}
PROJECT_ID: ****
Docker run failed with exit code 2
That was reported in w9jds/firebase-action
issue 17这是在
w9jds/firebase-action
issue 17 中报道的
For me it works when I remove "
--only hosting:prod
".对我来说,当我删除“
--only hosting:prod
”时它会起作用。
Probably it depends on the plan.可能这取决于计划。
You can't keep
--only hosting:prod
unless you have your site setup for multi-domain hosting inside of yourfirebase.json
file and one of the sites that you can deploy is calledprod
.你不能让
--only hosting:prod
,除非你有你的站点设置为托管您的内部多域firebase.json
文件和网站,您可以部署被称为一个prod
。
I would recommend to follow this way!我会建议按照这种方式!
name: Build and deploy
on:
push:
branches: [ main ]
# Run workflow manually
workflow_dispatch:
jobs:
build:
name: Build & Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@main
- name: Install dependencies
run: npm ci
- name: Build dependencies
run: npm run build
- name: Deploy to Firebase
uses: w9jds/firebase-action@master
with:
args: deploy --only hosting
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
You can replace npm commands with your yarn commands, and it should work fine.您可以用您的纱线命令替换 npm 命令,它应该可以正常工作。
Ref: https://gist.github.com/raviagheda/ec4baf4264219122cf6b420de89532a9参考: https://gist.github.com/raviagheda/ec4baf4264219122cf6b420de89532a9
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.