Skip to content

Instantly share code, notes, and snippets.

@Xainey
Created June 16, 2016 16:53
Show Gist options
  • Save Xainey/c420a66289afe36f9544288ba2ac25f7 to your computer and use it in GitHub Desktop.
Save Xainey/c420a66289afe36f9544288ba2ac25f7 to your computer and use it in GitHub Desktop.
Posh SMB Module Repo build versioning
$repoName = 'PoshGallery'
$repoPath = '\\server\PoshGallery'
$moduleName = 'MyModule'
$modulePath = 'C:\Temp\MyModule.psd1' # Jenkins would determine path
# Resister SMB Share
if(!(Get-PSRepository -Name $repoName -ErrorAction SilentlyContinue))
{
Register-PSRepository -Name $repoName -SourceLocation $repoPath -InstallationPolicy Trusted
}
# Update Existing module
if(Find-Module -Repository $repoName -Name $moduleName -ErrorAction SilentlyContinue)
{
# Increment version
$version = (Get-Module -FullyQualifiedName $modulePath -ListAvailable).Version | Select Major, Minor, Build, Revision
$version.Build++
Update-ModuleManifest -Path $modulePath -ModuleVersion $version
}
Publish-Module -Repository $repoName -Name $moduleName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment