【发布时间】:2020-02-09 15:20:58
【问题描述】:
我最近进入了 GitHub 操作,所以我想做的是在推送完成后将我的 react 项目托管在 firebase 中。我在这个 CI/CD 过程中使用了 GitHub 操作。这是我现在拥有的 main.yml。
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
working-directory: ./my-app
run: npm install
- name: Build
working-directory: ./my-app
run: npm run build
deploy:
name: Deploy
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
- name: Deploy to Firebase
uses: w9jds/firebase-action@master
with:
args: deploy --only hosting
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
并且我设法在 npm 安装和项目构建时设置了工作目录。但在部署中,我不断收到此错误,
所以我的理解是,这个错误是由于工作目录问题而发生的。所以我现在的项目结构是这样的。
. (root of my GitHub repository)
└── my-app
├── firebase.json <-- Git Hub action must point to this sub-dir
└── my-app-mobile
├── packages.json
那么我应该如何在我的 Firebase 部署过程中做到这一点?如果我对问题有误,问题和答案是什么?看来我不能将working-directory: ./my-app 与uses: 一起使用
【问题讨论】:
-
为什么不再使用
working-directory: ./my-app? -
它不能和'uses'一起使用
标签: firebase github github-actions