2626 Write-Debug " Path: $path "
2727 Push-Location
2828 Set-Location $Path
29-
29+
3030 # not safe!
3131 # populate what info we can from the path
3232 $username , $repo = ((git remote - v | ? {$_ -like " *(push)" }).replace(' .git' , ' ' ) -split ' \s+' )[1 ].split(" /" ) | select - last 2
3737 Write-Debug " Username: $username "
3838 Write-Debug " Repository: $repo "
3939 Write-Debug " Branch: $branch "
40-
40+
4141 $status = git status -- short| ? {$_ -match ' (.)(.)\s+(.+)' } | % {[pscustomobject ]@ {X = $matches [1 ];Y = $matches [2 ];File = $matches [3 ]}}
4242 if ($status )
4343 {
4848 }
4949 }
5050 Write-Verbose " Status: Committed and up to date"
51-
51+
5252 # # update version and commit?
5353 # # this will be replaced, just a test for commit purposes
5454 $psd1 = gi ((gi $path ).name + " .psd1" )
5555 Write-Debug " PSD1: $psd1 "
5656
57-
57+
5858 $psd1data = (gc $psd1 ) | % {
5959 if ($_ -match ' moduleversion\s*=(.+)' )
6060 {
6565 $versionfull = " $versionshort .$ ( Get-Date - Format " yyyyMMdd.HHmm" ) "
6666 " ModuleVersion='$versionfull '"
6767 Write-Verbose " New Versioin: $versionfull "
68-
68+
6969 }
7070 else {$_ }
7171 }
7878 Write-Verbose " Commiting version data"
7979 git commit - a - m " Release Commit - Version Tag $versionfull " | Out-Null
8080 git push origin $branch
81-
81+
8282 Write-Verbose " Creating tag"
8383 $tag = " V$versionshort "
8484 git tag - a $tag - m " Auto Release version $versionfull "
8585 git push -- tags
8686
8787 Write-Verbose " Getting Github auth token"
8888 $token = Get-GitToken - Credential $Credential
89-
89+
9090 Write-Verbose " Creating the release"
9191 $GHRelease = New-GitHubRelease - username $username - repo $repo - token $token - tag $tag - branch $branch - Title $title - Description $Description - draft:$draft.IsPresent - Prerelease:$Prerelease.IsPresent
92-
92+
9393 # # create a release folder, maybe clear it first?
94-
94+
9595 $releaseFolder = join-path $path Release
9696 Write-Verbose " Creating release folder"
97- mkdir $releaseFolder - ea 0 | out-null
98-
97+ New-Item - ItemType Directory $releaseFolder - ea 0 | out-null
98+
9999 # create a folder for module files
100100 Write-Verbose " Creating copy of module"
101101 $modtemp = join-path $releaseFolder $moduleName
102102 Write-Debug " creating temp folder: $modtemp "
103- mkdir $modtemp - ea 0 | Out-Null
103+ New-Item - ItemType Directory $modtemp - ea 0 | Out-Null
104104 # get all files
105105 $filenames = git ls- tree - r $branch -- name- only | ? {$_ -notlike " .*" }
106106 $files = $filenames | % {join-path . $_ } | gi
107107 # copy files to module temp/release location
108108 copy $files $modtemp
109-
110- Write-Verbose " Signing moved files"
109+
110+ Write-Verbose " Signing moved files"
111111 if ($Certificate )
112112 {
113113 gci $modtemp | Set-AuthenticodeSignature - Certificate $Certificate | Out-Null
114114 }
115115
116-
116+
117117 # # create packages
118118 # poshcode/nuget/chocolatey
119119 ipmo $modtemp - Global
120120 sleep 1
121121 Write-Verbose " Creating nuget package"
122122 $nugetfiles = Compress-Module - Module $moduleName - OutputPath $releaseFolder - Force
123-
123+
124124 # exclude xml
125125 # todo: move packageinfo/nuspec to repo add/overwite etc
126126 # todo: rename nuget file to remove extend version info
@@ -191,7 +191,7 @@ function New-GitHubRepo {
191191 # The name of the Repository to create
192192 [Parameter (Mandatory = $true )]
193193 [String ]$Name ,
194- # A short description of the repository
194+ # A short description of the repository
195195 [String ]$Description ,
196196 # A URL with more information about the repository
197197 [String ]$Homepage ,
@@ -298,4 +298,4 @@ function Get-GitToken {
298298 Write-Error " An unexpected error occurred (bad user/password?) $ ( $Error [0 ]) "
299299 }
300300 }
301- }
301+ }
0 commit comments