Skip to content

Commit

Permalink
updating pipeline with latest ubuntu and gitversion fix (#20)
Browse files Browse the repository at this point in the history
* updating pipeline with latest ubuntu and gitversion fix

* fix gitversion var name
  • Loading branch information
gaelcolas authored Nov 8, 2021
1 parent 5932358 commit bbb3a7f
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 38 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Fixed typo when adding debug output for GH task.
- Fixed using the `Set-SamplerTaskVariable` in GH tasks.
- Fixed the Azure DevOps pipeline to build on Ubunt latest.
22 changes: 13 additions & 9 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,18 @@ stages:
- job: Package_Module
displayName: 'Package Module'
pool:
vmImage: 'ubuntu 16.04'
vmImage: 'ubuntu-latest'
steps:
- task: GitVersion@5
- pwsh: |
dotnet tool install --global GitVersion.Tool
$gitVersionObject = dotnet-gitversion | ConvertFrom-Json
$gitVersionObject.psobject.properties.Foreach{
Write-Host -Object "Setting Task Variable '$($_.Name)' with value '$($_.Value)'."
Write-Host -Object "##vso[task.setvariable variable=$($_.Name);]$($_.Value)"
}
Write-Host -Object "##vso[build.updatebuildnumber]$($gitVersionObject.FullSemVer)"
displayName: Calculate ModuleVersion (GitVersion)
name: gitVersion
displayName: 'Evaluate Next Version'
inputs:
runtime: 'core'
configFilePath: 'GitVersion.yml'
- task: PowerShell@2
name: package
Expand All @@ -34,7 +38,7 @@ stages:
arguments: '-ResolveDependency -tasks pack'
pwsh: true
env:
ModuleVersion: $(gitVersion.NuGetVersionV2)
ModuleVersion: $(NuGetVersionV2)

- task: PublishPipelineArtifact@1
displayName: 'Publish Pipeline Artifact'
Expand All @@ -51,7 +55,7 @@ stages:
displayName: 'Linux'
timeoutInMinutes: 0
pool:
vmImage: 'ubuntu 16.04'
vmImage: 'ubuntu-latest'
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download Pipeline Artifact'
Expand Down Expand Up @@ -238,7 +242,7 @@ stages:
- job: Deploy_Module
displayName: 'Deploy Module'
pool:
vmImage: 'ubuntu 16.04'
vmImage: 'ubuntu-latest'
steps:
- task: DownloadPipelineArtifact@2
displayName: 'Download Pipeline Artifact'
Expand Down
56 changes: 32 additions & 24 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,38 @@ process
Set-BuildHeader -Script ([scriptblock]::Create($BuildInfo.TaskHeader))
}

<#
Add BuildModuleOutput to PSModule Path environment variable.
Moved here (not in begin block) because build file can contains BuiltSubModuleDirectory value.
#>
if ($BuiltModuleSubdirectory)
{
if (-not (Split-Path -IsAbsolute -Path $BuiltModuleSubdirectory))
{
$BuildModuleOutput = Join-Path -Path $OutputDirectory -ChildPath $BuiltModuleSubdirectory
}
else
{
$BuildModuleOutput = $BuiltModuleSubdirectory
}
} # test if BuiltModuleSubDirectory set in build config file
elseif ($BuildInfo.ContainsKey('BuiltModuleSubDirectory'))
{
$BuildModuleOutput = Join-Path -Path $OutputDirectory -ChildPath $BuildInfo['BuiltModuleSubdirectory']
}
else
{
$BuildModuleOutput = $OutputDirectory
}

# Pre-pending $BuildModuleOutput folder to PSModulePath to resolve built module from this folder.
if ($powerShellModulePaths -notcontains $BuildModuleOutput)
{
Write-Host -Object "[build] Pre-pending '$BuildModuleOutput' folder to PSModulePath" -ForegroundColor Green

$env:PSModulePath = $BuildModuleOutput + [System.IO.Path]::PathSeparator + $env:PSModulePath
}

<#
Import Tasks from modules via their exported aliases when defined in Build Manifest.
https://github.com/nightroman/Invoke-Build/tree/master/Tasks/Import#example-2-import-from-a-module-with-tasks
Expand Down Expand Up @@ -408,30 +440,6 @@ Begin
}
}

if ($BuiltModuleSubdirectory)
{
if (-not (Split-Path -IsAbsolute -Path $BuiltModuleSubdirectory))
{
$BuildModuleOutput = Join-Path -Path $OutputDirectory -ChildPath $BuiltModuleSubdirectory
}
else
{
$BuildModuleOutput = $BuiltModuleSubdirectory
}
}
else
{
$BuildModuleOutput = $OutputDirectory
}

# Pre-pending $BuildModuleOutput folder to PSModulePath to resolve built module from this folder.
if ($powerShellModulePaths -notcontains $BuildModuleOutput)
{
Write-Host -Object "[pre-build] Pre-pending '$BuildModuleOutput' folder to PSModulePath" -ForegroundColor Green

$env:PSModulePath = $BuildModuleOutput + [System.IO.Path]::PathSeparator + $env:PSModulePath
}

<#
The variable $PSDependTarget will be used below when building the splatting
variable before calling Resolve-Dependency.ps1, unless overridden in the
Expand Down
10 changes: 5 additions & 5 deletions source/en-US/about_Sampler.GitHubTasks.help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ SHORT DESCRIPTION
Sampler tasks for GitHub integrations

LONG DESCRIPTION
{{ Add Long description here }}
This modules contains tasks to publish Release and artifacts to GitHub, and to create pull request to changelog.
This is to be used with the Sampler pipeline.

EXAMPLES
PS C:\> {{ add examples here }}
PS C:\> ./build.ps1 -Tasks Publish_release_to_GitHub

NOTE:
Thank you to all those who contributed to this module, by writing code, sharing opinions, and provided feedback.
Expand All @@ -17,8 +18,7 @@ TROUBLESHOOTING NOTE:
Look out on the Github repository for issues and new releases.

SEE ALSO
- {{ Please add Project URI such as github }}}
- https://github.com/gaelcolas/Sampler

KEYWORDS
{{ Add coma separated keywords here }}

Sampler, GitHub, template, plater, tasks, InvokeBuild

0 comments on commit bbb3a7f

Please sign in to comment.