Skip to content

PublishProGetUniversalPackage Task

Aaron Jensen edited this page Jun 14, 2023 · 3 revisions

Overview

The PublishProGetUniversalPackage task uploads a universal package to ProGet. By default, it uploads all *.upack files in the build output directory. Pass paths to specific upack files to the Path property. It uses the Publish-ProGetUniversalPackage function from the ProGetAutomation module to upload the file. If a upack file is invalid, you'll get an error and nothing will upload.

If uploading requires authentication, set the CredentialID property to the ID of the credential to use when uploading. Add the credential with the Add-WhiskeyCredential function.

Set the Uri property to the base URI to ProGet. Set the FeedName property to the name of the universal feed to which you want to upload. By default, the upload will time out after 100 seconds. To change the default timeout, set the Timeout property to the number of seconds to wait before cancelling and timing out the upload.

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

Properties

  • Uri (mandatory): the base URI to the instance of ProGet where the package should be uploaded.
  • FeedName (mandatory): the name of the universal feed in ProGet where the package should be uploaded.
  • CredentialID: if ProGet requires authentication when uploading universal packages, this should be the ID of the credential to use. Add credentials to your build with the Add-WhiskeyCredential function.
  • Path: the paths to any upack files to upload. By default, all *.upack files in the .output directory are uploaded. Paths must exist, be to files, and be under the build root.
  • Timeout: the timeout, in seconds, to use when uploading the file. If the upload request takes longer than this, it will be cancelled and the build will fail.
  • Overwrite: replace/overwrite the package if it already exists in ProGet. The default behavior is to fail/stop if the package exists.
  • AllowMissingPackage: by default, if the paths in the Path property don't exist, the build will fail. To not fail the build when there are missing packages, set this property to true.
  • Exclude: Any paths to exclude from publishing. Wildcards are required. The exclusion is matched against the full path of each item from the Path property. If you don't care about the directory structure, each item should look like *\filename.upack.
  • ProGetAutomationVersion: the version of the ProGetAutomation PowerShell module to download and use. The default is the latest 1.* version.

Examples

Example 1

Publish:
- PublishProGetUniversalPackage:
    Uri: https://proget.example.com
    FeedName: Apps

Demonstrates the minimal configuration needed to upload a package. In this case, all *.upack files in the .output directory will be uploaded to http://proget.example.com/upack/Apps. No authenticaton will be used.

Example 2

- PublishProGetUniversalPackage:
    Uri: https://proget.example.com
    FeedName: Apps
    Path:
    - .output\App-*.upack
    CredentialID: proget.example.com
    Timeout: 600

Demonstrates the full configuration available to upload a packae. In this example, only the App-*.upack file(s) will be uploaded to http://proget.example.com/upack/Apps using the credential with the proget.example.com ID. The upload will be allowed to take ten minutes, then will be cancelled.

Example 3

- PublishProGetUniversalPackage:
    Uri: https://proget.example.com
    FeedName: Apps
    Path:
    - .output\App-*.upack
    Exclude:
    - "*\\App-Bad.upack"

Demonstrates how to exclude a package from being published. In this case, any path that ends with "App-Bad.upack" will not be published. Exclusion items are matched against the full path of items from the Path property.

Clone this wiki locally