【问题标题】:Using github actions to create a folder and upload it to a destination使用 github 操作创建文件夹并将其上传到目标
【发布时间】:2022-01-26 16:09:17
【问题描述】:

我正在运行一个创建文件夹 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 然后在第二个作业中使用downlod artifact 下载此工件,然后再执行您执行的操作想要第二份工作。你可以在GHA official documentation找到更多信息
  • 非常感谢!
  • 欢迎您!我将答案添加为官方答案????????????

标签: github-actions


【解决方案1】:

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

要实现您想要的,您需要将dist 目录作为工件 上传(使用upload action 然后在第二个作业中使用download action 下载此工件,然后再执行你想对第二份工作采取的行动。

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

【讨论】:

    猜你喜欢
    • 2021-12-18
    • 1970-01-01
    • 1970-01-01
    • 2021-07-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-31
    • 1970-01-01
    相关资源
    最近更新 更多