Gitlab CD/CI: 用户提供的路径build/不存在

Gitlab CD/CI: The user-provided path build/ does not exist

我创建了一个简单的反应来练习 gitlab 的 CI/CD 管道。我有 CD/CI 管道的三个工作。首先测试应用程序,然后构建然后部署到 AWS 的 S3 存储桶。成功通过测试和 运行 构建生产后,当它进入部署阶段时,我收到此错误:The user-provided path build does not exist. 我不知道如何在 Gitlab's cd/ci pipeline.

中创建路径

这是我的gitlab的.gitlab-ci.yml文件设置

image: 'node:12'
stages:
  - test
  - build
  - deploy

test:
  stage: test
  script:
    - yarn install
    - yarn run test

variables:
  AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
  AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
  AWS_REGION: $AWS_REGION
  S3_BUCKET_NAME: $S3_BUCKET_NAME

build:
  stage: build
  only:
    - master
  script:
    - npm install
    - npm run build

deploy:
  stage: deploy
  only:
    - master
  image: python:latest
  script:
     - pip install awscli
     - aws s3 cp build/ s3://$S3_BUCKET_NAME/ --recursive --include "*" 

如果 build/ 文件夹是作为 build 阶段的一部分创建的,那么它应该作为人工制品传递给 deploy 阶段并且 deploy 应该引用 build阶段使用dependencies:

build:
  stage: build
  only:
    - master
  script:
    - npm install
    - npm run build
  artifacts:
    paths:
      - build/

deploy:
  stage: deploy
  only:
    - master
  image: python:latest
  dependencies:
    - build
  script:
     - pip install awscli
     - aws s3 cp build/ s3://$S3_BUCKET_NAME/ --recursive --include "*"