提问者:小点点

使用github操作将部署反应到firebase


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: build
          path: build
  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: build
      - name: Deploy to Firebase
        uses: w9jds/firebase-action@master
        with:
          args: deploy --only hosting
        env:
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

现在这是gtihub操作工作流,它正在执行构建作业,没有错误,但在部署中出现了一个错误,这是错误图像,它显示的错误是错误:指定的公共目录‘构建’不存在,不能部署主机到站点登陆-页面-设计-1我跟踪了博客,从哪里复制工作流我做的一切都一样,除了一些我的项目细节,这是显而易见的,请帮助我为什么会出现这个错误,我如何才能修复它


共1个答案

匿名用户

您可能正在将工件解包到根目录,而不是build/。 我猜这篇文章是在您使用download-artifact@v2时为download-artifact@v1编写的(因为这是master当前指向的地方)。 这里讨论了两者之间的区别。

我会先验证下载工件后发生了什么

- name:  Display directory structure
  run:   ls -R
  shell: bash

如果文件确实在根目录中,添加path应该可以解决这个问题。

- name: Download Artifact
  uses: actions/download-artifact@v2
  with:
   name: build
   path: build

ps:不建议使用操作/@master,因为如果同一操作在不同版本之间的行为不同,这总是会导致问题。。。 例如actions/download-artifact;)