使用 github 操作创建文件夹并将其上传到目的地

Using github actions to create a folder and upload it to a destination

我 运行 一个创建文件夹的作业 dist 和另一个作业取决于第一个要成功完成以上传 dist 文件夹。但是,我在上传时遇到错误,说该目录不存在,而它可以在本地创建文件夹并将其推送到 github。我不想将文件夹推送到我的存储库,有什么办法吗?

name: Build Artifcats and Upload To Azure Blob Storage
on:
  push:
    branches:
      - main

jobs:
  build_on_win:
    runs-on: windows-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-node@master
      with:
        node-version: 14.2.0
Running Scripts**......... 

  upload:
    runs-on: ubuntu-latest
    needs: build_on_win   (Notice here I'm waiting for the artifacts to be built)
    steps:
      - uses: actions/checkout@v2
      - uses: bacongobbler/azure-blob-storage-upload@v1.2.0
        with:
          source_dir: ./solutions/app/dist
          container_name: 'app/latest'
          connection_string: .......
          sync: true
  

作业之间不共享文件夹(和文件)。

要实现您想要的效果,您需要将 dist 目录作为 工件 上传(在执行您想要的操作之前使用 upload action then download this artifact on the second job with the download action在第二份工作中。

您可以在 GHA official documentation 上找到更多信息。