将文件复制到 GitHub 工作区

use*_*060 3 github github-actions

我有几个步骤可以将一些文件夹从源代码复制到 GitHub WorkSpace,如下所示。在运行这个构建我看到

警告:未找到具有提供路径的文件:${GITHUB_WORKSPACE}。不会上传任何工件。

我检查并确认两个文件夹都不为空。我错过了什么?

   - name: copy arm templates
      run: Copy 'Infrastructure/' '${GITHUB_WORKSPACE}/Infrastructure'
      shell: powershell
      
    - name: copy release management scripts
      run: Copy 'Scripts/' '${GITHUB_WORKSPACE}/Scripts'
      shell: powershell
      
    - name: publish artifact
      uses: actions/upload-artifact@v2
      with:
        path: ${GITHUB_WORKSPACE}
        name: ${{ env.VERSION_MAJOR }}.${{ env.VERSION_MINOR }}
  
Run Code Online (Sandbox Code Playgroud)

riQ*_*iQQ 5

您使用表达式和 GitHub 操作上下文的语法错误(参考:https : //docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions)。

使用${{ github.workspace }}代替${GITHUB_WORKSPACE}

    - name: publish artifact
      uses: actions/upload-artifact@v2
      with:
        path: ${{ github.workspace }}
        name: ${{ env.VERSION_MAJOR }}.${{ env.VERSION_MINOR }}
Run Code Online (Sandbox Code Playgroud)