当我尝试使用提供错误的 GitHub操作部署 firebase 项目时
我的 ci.yaml 文件是:
name: Build and Deploy
on:
push:
branches:
- master
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
- name: Install Dependencies
run: npm install
- name: Build
run: npm run build
- name: Archive Production Artifact
uses: actions/upload-artifact@master
with:
name: dist
path: dist
deploy:
name: Deploy
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
- name: Download Artifact
uses: actions/download-artifact@master
with:
name: dist
- name: Deploy to Firebase
uses: w9jds/firebase-action@master
with:
args: deploy --only hosting:prod
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
我的项目基于 react web app ,当我将存储库推送到使用GitHub action构建的GitHub并将项目部署到firebase时。
dist 是公共目录,生产代码将在此目录中部署到Firebase
答案 0 :(得分:1)
更改所有dist以进行构建 在我的情况下有效
答案 1 :(得分:0)
我认为以下问题/答案可能是您解决问题的方法。
How to add working directory to deployment in GitHub actions
您现在可以使用PROJECT_PATH
将路径设置为firebase.json。尝试将操作设置更改为以下内容。
- name: Deploy to Firebase
uses: w9jds/firebase-action@master
with:
args: deploy --only hosting:prod
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
PROJECT_PATH: ./dist
答案 2 :(得分:0)
我没有在该Firebase项目中使用任何环境(例如,用于广告制作和生产)或其他别名。
有关更多信息,Deploy to multiple environments with Firebase Hosting
所以只需要deploy --only hosting
- name: Deploy to Firebase
uses: w9jds/firebase-action@master
with:
args: deploy --only hosting
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
PROJECT_PATH: ./dist