圈ci 2. sentry-cli找不到dist文件夹上传源图

Circle ci 2. sentry-cli can't find find dist folder to upload source maps

我有一个使用 web pack 的 Reactjs web 项目。当我进行产品构建时,会创建一个 dist 文件夹,其中包含源映射。然后每次我创建一个新标签时,我都会在 Sentry 中创建一个新版本。但是 circle 在 docker 图像中找不到 dist 文件夹,这意味着 circle 构建失败。

  - run:
      name: Install sentry-cli
      command: curl -sL https://sentry.io/get-cli/ | bash

  - run:
      name: Create new sentry release from latest tag
      command: sentry-cli releases -o my-org -p my-project new ${CIRCLE_TAG/v/}

  - run:
      name: Upload Source Maps to sentry
      command: sentry-cli releases -o my-org -p my-project files ${CIRCLE_TAG/v/} upload-sourcemaps ./dist

我 运行 这是在新标签被推送到 docker 之后,但我得到了这个错误。

error: ./dist: IO error for operation on ./dist: No such file or directory (os error 2)
Exited with code 1

我怎样才能访问我的带有源映射的 dist 文件夹?

我不确定您的项目是如何设置的 - 但通常 dist 文件夹位于 .gitignore 中,而不是上传到 GIT,因此在CI.

如果您在 CI 上构建应用程序,则 dist 文件夹将可用。我假设您的构建命令是 npm run build,但它也可以是 yarn build 或您用来构建应用程序的任何自定义命令。

- run:
    name: Build react application
    command: npm run build

- run:
    name: Install sentry-cli
    command: curl -sL https://sentry.io/get-cli/ | bash

- run:
    name: Create new sentry release from latest tag
    command: sentry-cli releases -o my-org -p my-project new ${CIRCLE_TAG/v/}

- run:
    name: Upload Source Maps to sentry
    command: sentry-cli releases -o my-org -p my-project files ${CIRCLE_TAG/v/} upload-sourcemaps ./dist