无法找到关联工作流程的任何工件 - github actions

问题描述 投票:0回答:1

我有两个相同 github 工作流程的工作。 第一个作业生成一个工件并上传它。这是日志:

Run actions/upload-artifact@v4
With the provided path, there will be 58 files uploaded
Artifact name is valid!
Root directory input is valid!
Beginning upload of artifact content to blob storage
Uploaded bytes 6049904
Finished uploading artifact content to blob storage!
SHA256 hash of uploaded artifact zip is 234760fcd4148780c7f4cbb3a0296eca3a3c5ae0d54457fbd5d2f97c7411d00a
Finalizing artifact upload
Artifact DIS_1.0.5.zip successfully finalized. Artifact ID 1366404513
Artifact DIS_1.0.5 has been successfully uploaded! Final size is 6049904 bytes. Artifact ID is 1366404513
Artifact download URL: https://github.com/my-company-url/DIS.API/actions/runs/8466719969/artifacts/1366404513

第二项工作,由于某种原因无法找到工件,即使我故意删除名称,这应该强制执行下载所有工件的步骤。 这是第二个作业的日志:

Run actions/download-artifact@v3
No artifact name specified, downloading all artifacts
Creating an extra directory for each artifact that is being downloaded
Unable to find any artifacts for the associated workflow
There were 0 artifacts downloaded
Artifact download has finished successfully

知道是什么原因造成的吗? 这是整个管道脚本:

name: build-and-deploy

# todo: delete this and use the one below
on: [workflow_dispatch]

# todo: use this and delete the one above
# on:
#   push:
#     branches: ["main"]
#   pull_request:
#     branches: ["main"]

env:
  DOTNET_INSTALL_DIR: "./.dotnet"
  VERSION: 1.0.${{ github.run_number }}
  PACKAGE_STORE_NAME: Nexus # Package store name in the nuget.config file.
  PACKAGE_STORE_URI: https://nexus.milestone.dev # The URI
  PACKAGE_STORE_REPO: experimental-nuget # and repo
  BUILD_CONFIGURATION: -c Release

jobs:
  build:
    runs-on: gha-runner-scale-set-linux
    steps:
      - uses: actions/checkout@v3

      - name: Apt update
        run: sudo apt-get update

      - name: Install CURL
        run: sudo apt-get install -y curl

      - name: Setup .NET
        uses: actions/setup-dotnet@v3
        with:
          dotnet-version: 8.0.x

      - name: Update Nuget Source
        run: dotnet nuget update source nexus --username ${{secrets.NEXUS_PIPELINE_SERVICE_TOKEN_USER}} --password ${{ secrets.NEXUS_PIPELINE_SERVICE_TOKEN_PASSWORD}} --store-password-in-clear-text

      - name: Restore dependencies
        run: dotnet restore

      - name: Build
        run: dotnet build ${{ env.BUILD_CONFIGURATION }} --no-restore

      - name: Test
        run: dotnet test ${{ env.BUILD_CONFIGURATION }} --no-build --verbosity normal 

      - name: Dotnet Publish API
        if: github.ref == 'refs/heads/main'
        run: dotnet publish ./DIS.Web/DIS.Web.csproj ${{ env.BUILD_CONFIGURATION }} --no-build -o ./publish

      - name: "Upload Artifact"
        if: github.ref == 'refs/heads/main'
        uses: actions/upload-artifact@v4
        with:
          name: DIS_${{ env.VERSION }}
          path: ./publish
          retention-days: 5
  publish-docker-image:
    runs-on: gha-runner-scale-set-linux
    needs: build
    steps:
      - name: Download Artifact
        uses: actions/download-artifact@v3
        with:
          name: DIS_${{ env.VERSION }}
      - name: List Artifact Contents
        run: ls -R
        
github-actions
1个回答
0
投票

错误消息不清楚,但您的问题与

actions/download-artifact
actions/upload-artifact
标签之间的兼容性有关。

您需要这两个操作才能使用同一版本

@v3
@v4
)。

使用

v4
的示例:

jobs:
  build:
    runs-on: gha-runner-scale-set-linux
    steps:
      [ ... ]
      - name: "Upload Artifact"
        if: github.ref == 'refs/heads/main'
        uses: actions/upload-artifact@v4
        with:
          name: DIS_${{ env.VERSION }}
          path: ./publish
          retention-days: 5
  
  publish-docker-image:
    runs-on: gha-runner-scale-set-linux
    needs: build
    steps:
      - name: Download Artifact
        uses: actions/download-artifact@v4 # UPDATE HERE
        with:
          name: DIS_${{ env.VERSION }}
      - name: List Artifact Contents
        run: ls -R
© www.soinside.com 2019 - 2024. All rights reserved.