1
- param (
2
- # Base directory of all output (default to 'output')
3
-
1
+ param
2
+ (
4
3
[Parameter ()]
5
4
[System.String ]
6
5
$BuiltModuleSubdirectory = (property BuiltModuleSubdirectory ' ' ),
@@ -11,11 +10,11 @@ param (
11
10
12
11
[Parameter ()]
13
12
[System.String ]
14
- $ProjectName = (property ProjectName $ ( Get-SamplerProjectName - BuildRoot $BuildRoot ) ),
13
+ $ProjectName = (property ProjectName ' ' ),
15
14
16
15
[Parameter ()]
17
16
[System.String ]
18
- $SourcePath = (property SourcePath $ ( Get-SamplerSourcePath - BuildRoot $BuildRoot ) ),
17
+ $SourcePath = (property SourcePath ' ' ),
19
18
20
19
[Parameter ()]
21
20
$ChangelogPath = (property ChangelogPath ' CHANGELOG.md' ),
@@ -29,7 +28,7 @@ param (
29
28
30
29
[Parameter ()]
31
30
[string ]
32
- $ReleaseBranch = (property ReleaseBranch ' master ' ),
31
+ $ReleaseBranch = (property ReleaseBranch ' main ' ),
33
32
34
33
[Parameter ()]
35
34
[string ]
@@ -49,14 +48,13 @@ param (
49
48
$SkipPublish = (property SkipPublish ' ' ),
50
49
51
50
[Parameter ()]
52
- $MainGitBranch = (property MainGitBranch ' master ' )
51
+ $MainGitBranch = (property MainGitBranch ' main ' )
53
52
)
54
53
55
54
task Publish_release_to_GitHub - if ($GitHubToken -and (Get-Module - Name PowerShellForGitHub - ListAvailable)) {
56
55
57
56
. Set-SamplerTaskVariable
58
57
59
-
60
58
$ReleaseNotesPath = Get-SamplerAbsolutePath - Path $ReleaseNotesPath - RelativeTo $OutputDirectory
61
59
" `t Release Notes Path = '$ReleaseNotesPath '"
62
60
@@ -65,19 +63,16 @@ task Publish_release_to_GitHub -if ($GitHubToken -and (Get-Module -Name PowerShe
65
63
66
64
" `t Project Path = $ProjectPath "
67
65
68
- # find Module's nupkg
69
- $PackageToRelease = Get-ChildItem (Join-Path $OutputDirectory " $ProjectName .$moduleVersion .nupkg" )
66
+ # find Module's nupkg if it exists
67
+ $packagedProjectNupkg = Join-Path - Path $OutputDirectory - ChildPath " $ProjectName .$moduleVersion .nupkg"
68
+ $PackageToRelease = Get-ChildItem - Path $packagedProjectNupkg - ErrorAction Ignore
69
+ # If the Project nupkg is not found, don't fail. You can still create a release and specify the
70
+ # assets in the build.yml (i.e. Chocolatey packages or Azure Policy Guest Config Packages)
70
71
$ReleaseTag = " v$ModuleVersion "
71
72
72
73
Write-Build DarkGray " About to release '$PackageToRelease ' with tag and release name '$ReleaseTag '"
73
74
$remoteURL = git remote get-url origin
74
75
75
- if ($remoteURL -notMatch ' github' )
76
- {
77
- Write-Build Yellow " Skipping Publish GitHub release to $RemoteURL "
78
- return
79
- }
80
-
81
76
# Retrieving ReleaseNotes or defaulting to Updated ChangeLog
82
77
if (Import-Module ChangelogManagement - ErrorAction SilentlyContinue - PassThru)
83
78
{
0 commit comments