Pipelines: cannot publish a file from artifacts directory

Romeo Mihalcea

I have this pipeline file where I create an exe file from an Electron app. At the end of it I'm publishing a Github release with the resulted file (that's what I'm trying at least). The problem is that the exe file is not found when doing the release.

-   job: Release
    dependsOn:
        - WindowsBuild
    pool:
        vmImage: 'ubuntu-latest'
    steps:
        -   bash:
                echo "##vso[task.setvariable variable=GIT_TAG]$(git describe --tags --always)"
            displayName: "Set the tag name"

        -   task: [email protected]
            inputs:
                artifact: 'Windows'
                path: $(Build.ArtifactStagingDirectory)

        -   bash:
                ls -la '$(Build.ArtifactStagingDirectory)'
            displayName: "List artifacts dir"

        -   task: [email protected]
            displayName: "Github release"
            inputs:
                gitHubConnection: 'github connection'
                repositoryName: '$(Build.Repository.Name)'
                assets: |
                    '$(Build.ArtifactStagingDirectory)/app.exe'
                action: 'edit'
                target: '$(Build.SourceVersion)'
                tagSource: gitTag
                tag: '$(GIT_TAG)'
                addChangeLog: true
                assetUploadMode: replace
                changeLogCompareToRelease: lastNonDraftRelease
                title: 'Release $(GIT_TAG)'

As you can see, one of the tasks I execute is ls -la '$(Build.ArtifactStagingDirectory)' so I can see what's in the ArtifactStagingDirectory:

Starting: List artifacts dir
==============================================================================
Task         : Bash
Description  : Run a Bash script on macOS, Linux, or Windows
Version      : 3.159.3
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/bash
==============================================================================
Generating script.
Script contents:
ls -la '/home/vsts/work/1/a'
========================== Starting Command Output ===========================
/bin/bash --noprofile --norc /home/vsts/work/_temp/4a24644d-728f-4a2a-a7d9-12a5de01f75d.sh
total 70480
drwxr-xr-x 2 vsts docker     4096 Jan 25 17:15 .
drwxr-xr-x 6 vsts docker     4096 Jan 25 17:14 ..
-rw-r--r-- 1 vsts docker 72161249 Jan 25 17:15 app.exe

Finishing: List artifacts dir

The app.exe file is present. The very next task is GitHubRelease which has the specified asset as '$(Build.ArtifactStagingDirectory)/app.exe' which....is not found:

Starting: Github release
==============================================================================
Task         : GitHub Release
Description  : Create, edit, or delete a GitHub release
Version      : 1.160.2
Author       : Microsoft Corporation
Help         : https://aka.ms/AA5vv5o
==============================================================================
b1a3412a-0bb2-48a8-8dfc-bc2109012f38 exists true
Computing changes made in this release...
Fetching the latest non-draft release...
Found the latest non-draft release
Fetching the list of commits since the last published release...
Found the list of changes.
Changes computed successfully.
Release notes file: /home/vsts/work/1/s is a directory and not a file.
Fetching the release for tag: v0.0.28
##[warning]No existing release was found to edit. Creating one with the tag: v0.0.28
Creating a release for tag: v0.0.28
Uploading assets...
Searching for file(s) matching ''/home/vsts/work/1/a/app.exe''.
No files found matching ''/home/vsts/work/1/a/app.exe''. Nothing to upload.
All assets uploaded successfully.
Release created successfully at https://github.com/app/desktop/releases/tag/v0.0.28
Finishing: Github release

Any ideas as to what am I doing wrong here>?

Eric Smith

Try and remove the single quotes from this line in the YAML

assets: |
         '$(Build.ArtifactStagingDirectory)/app.exe'

It looks like it is getting interpreted with a duplicate single quotes.

Uploading assets...
Searching for file(s) matching ''/home/vsts/work/1/a/app.exe''

I have seen this on other Azure DevOps tasks when you use a | for the multi line format.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

TFS 2015 Publish Build Artifacts in one directory

Azure Devops - Publish Pipelines Artifacts: Build Id is not valid

cannot read file from a directory

How to manually publish a file to Azure Artifacts?

VSTS: Publish build artifacts to Azure File Storage

How to publish custom artifacts to Artifactory from TeamCity?

Excluding File From Publish Directory in VS 2017 .NET Core Project

Cannot load properties file from resources directory

Cannot remove file from working directory

Cannot locate file from parent directory(s)

batch file failed and cannot copy file from one directory to another

Gradle Artifactory Plugin - How to publish artifacts from multiple modules in a project?

How to publish Travis CI artifacts to GitHub Release from several jobs

How to publish and download artifacts from multiple jobs into one location on pipeline?

Artifacts in Azure Devops Pipelines

"Cannot create directory ... no such file or directory"

cannot open No such file or directory

PHP Cannot access variable from another php file in another directory

Ubuntu Cannot download file from a server to local directory

Cannot delete file - No such file or directory

Cannot remove <file>: No such file or directory

Cannot decompress .tar.xz file, getting "xz: Cannot exec: No such file or directory" from tar

Npm pack / publish: File cannot be found

Cannot select WSO2 artifacts for CAR file

Maven: How to unpack precise files from artifacts in the same output directory?

Is it possible to output and rename build artifacts from the TeamCity checkout directory (that are not archives)?

publish artifacts to scp repository if success

Publish Artifacts for website goes to PrecompiledWeb

mkdir: cannot create directory: No such file or directory

TOP Ranking

HotTag

Archive