Skip to content

Instantly share code, notes, and snippets.

@dneimke
Created April 16, 2022 06:00
Show Gist options
  • Select an option

  • Save dneimke/e4a7e2d35fa7b0e860daa0718e73cf58 to your computer and use it in GitHub Desktop.

Select an option

Save dneimke/e4a7e2d35fa7b0e860daa0718e73cf58 to your computer and use it in GitHub Desktop.
Example script for building versioned deployment packages for Octopus. Refer article on Medium for additional information https://medium.com/@dneimke/hosting-packaged-code-in-octopus-8513ab6028ad
trigger:
branches:
include:
- main
pool:
vmImage: windows-latest
stages:
- stage: build
displayName: Build an Octopus package
variables:
buildConfiguration: Release
jobs:
- job: build
displayName: Build
steps:
- task: gitversion/setup@0
displayName: Set up GitVersion
inputs:
versionSpec: '5.x'
includePrerelease: true
- task: gitversion/execute@0
displayName: Generate a version number
inputs:
useConfigFile: true
configFilePath: './gitversion.yml'
- script: echo: SemVer $(GitVersion.SemVer)
displayName: Display the version number
- script: dotnet tool install Octopus.DotNet.Cli -g
displayName: Install the Octopus CLI tool
- script: |
dotnet octo pack --id="Project.HandyScripts" --version="$(GitVersion.SemVer)" --format=NuPkg --description="Handy scripts for Octopus deployment package"
- task: CopyFiles@2
displayName: "Copy deployment package to artifacts directory"
inputs:
Contents: "*.nupkg"
TargetFolder: "$(Build.ArtifactStagingDirectory)"
- publish: "$(Build.ArtifactStagingDirectory)"
artifact: octopus-package
displayName: Publish artifacts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment