Github Actions 为 Angular 项目部署一个空白的 Firebase 页面

时间:2021-05-11 17:56:29

标签: angular firebase web-deployment github-actions firebase-hosting

我在为 Angular 10 项目部署 github 操作时遇到了一些问题,因为每当它自动执行时,它都会显示一个空白页面。但是,当我在控制台上使用 firebase deploy 时,它会正确部署。我猜它的目录失败了,但我一直在尝试很多东西,但没有一个适合我的问题。 这是 github 操作的代码:

on: push
name: Patitas CI
defaults:
  run:
    working-directory: ./vet-patitas

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [12.x]

    steps:
      - uses: actions/checkout@v1

      - name: Cache node modules
        uses: actions/cache@v1
        with:
          path: ~/.npm
          key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
          restore-keys: |
            ${{ runner.os }}-node-
      - name: Node ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - name: npm install and npm run build
        run: |
          npm i
          npm run build
        
  firebase-deploy:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@master
    - uses: actions/setup-node@master
      with:
        node-version: '10.x'
        run: |
          npm i
          npm run build:prod
    - uses: w9jds/firebase-action@master
      with:
        args: deploy --only hosting
      env:
        FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

这就是目录的样子:

explorer view, directory structure

提前感谢您的帮助!

0 个答案:

没有答案