【问题标题】:Github Actions deploy artifactsGithub Actions 部署工件
【发布时间】:2020-01-31 14:26:22
【问题描述】:

将工件部署到 S3 时,以下工作流程失败。在最后一行,在部署作业中,它抱怨 ./build 不存在,可能是因为它找不到工件。

The user-provided path ./build does not exist.
##[error]Process completed with exit code 255.

如何让它识别在构建作业中创建的工件?

name: Build and deploy
on:
  push:
    branches:
      - master
jobs:
  build:
    name: Build
    runs-on: ubuntu-18.04
    strategy:
      matrix:
        node-version: [10.x]
    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - run: |
          npm i -D
          npm test --if-present
          npm run build:prod
        env:
          CI: true
      - name: Upload Artifact
        uses: actions/upload-artifact@master
        with:
          name: build
          path: build
  deploy:
    name: Deploy
    needs: build
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@master
      - name: Deploy to S3
        env:
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        run: |
          aws s3 cp \
          --recursive \
          --acl public-read \
          --region ap-southeast-2 \
          ./build s3://example

【问题讨论】:

    标签: github github-actions


    【解决方案1】:

    您需要在部署作业中下载工件。请参阅actions/download-artifact 操作。

      deploy:
        name: Deploy
        needs: build
        runs-on: ubuntu-18.04
        steps:
          - uses: actions/checkout@master
          - name: Download Artifact
            uses: actions/download-artifact@master
            with:
              name: build
              path: build
          - name: Deploy to S3
            env:
              AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
              AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
            run: |
              aws s3 cp \
              --recursive \
              --acl public-read \
              --region ap-southeast-2 \
              ./build s3://example
    

    【讨论】:

      猜你喜欢
      • 2020-02-17
      • 1970-01-01
      • 2021-02-09
      • 2021-09-02
      • 2020-12-20
      • 2020-10-16
      • 1970-01-01
      • 1970-01-01
      • 2021-11-26
      相关资源
      最近更新 更多