Created
June 16, 2016 16:53
-
-
Save Xainey/c420a66289afe36f9544288ba2ac25f7 to your computer and use it in GitHub Desktop.
Posh SMB Module Repo build versioning
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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