Skip to content

PublishProGetAsset Task

Joseph Larionov edited this page Jun 13, 2024 · 2 revisions

Overview

The PublishProGetAsset task adds files to a ProGet asset directory. Specify the asset directory's name with the AssetDirectory property. Specify the path to the file in the asset directory with the AssetPath parameter. Specify the path to the file to upload via the Path property.

You can publish multiple assets. Set the Path property to a list of files to publish. There must be an equal number of destination paths in the AssetPath property. The first item in the Path list will be published using the first path in the AssetPath property, and so forth.

If publishing to your asset directory requires credentials, pass the credential ID to the CredentialID parameter. Use the Add-WhiskeyCredential function to add the credential to your build.

This task downloads and uses the ProGetAutomation PowerShell module from the PowerShell Gallery.

Properties

  • Url (Mandatory): The URL to the ProGet instance.
  • Path (Mandatory): The relative paths to the files/directories to upload to ProGet. Paths should be relative to the whiskey.yml file they were taken from.
  • AssetPath (Mandatory): The desired Paths to the location you wish the file to be uploaded to in ProGet. The last item in the path is the asset name. The number of names provided must equal the number of file paths.
  • AssetDirectory (Mandatory): The root asset Directory you wish to upload the asset to.
  • ProGetAutomationVersion: the version of the ProGetAutomation PowerShell module to download and use. The default is the latest 0.4.* version. Be careful about changing the version. The task may not support newer/olders versions.
  • CredentialID: The ID to the ProGet Credential. Set the CredentialID property to the ID of the credential to use when uploading. Add the credential with the Add-WhiskeyCredential function.
  • ContentType: The MIME type to set for the published item in ProGet. Defaults to application/octet-stream.

Examples

Example 1

This example demonstrates adding an asset named exampleAsset to ProGet in a versions ProGet asset directory.

Build:
- PublishProGetAsset:
    Url: http://proget.example.com/
    Path: 'path/to/file.txt'
    AssetPath: 'exampleAsset'
    AssetDirectory: 'versions'
    CredentialID: ProGetCredential

Example 2

This example demonstrates adding two assets named file.txt and anotherfile.txt to ProGet in the exampleDirectory/asset/path and exampleDirectory/asset directories, respectively.

Build:
- PublishProGetAsset:
    Url: http://proget.example.com/
    Path: 
    - 'path/to/file.txt'
    - 'Path/to/anotherfile.txt'
    AssetPath: 
    - 'asset/path/file.txt'
    - 'asset/anotherfile.txt'
    AssetDirectory: 'exampleDirectory'
    CredentialID: ProGetCredential

Example 3

This example demonstrates publishing an asset with an application/json MIME type:

Build:
- PublishProGetAsset:
    Url: http://proget.example.com/
    Path: versions.json
    AssetPath: versions.json
    AssetDirectory: Public
    CredentialID: ProGetCredential
    ContentType: application/json
Clone this wiki locally