Skip to content

Fix another bug in ReleaseTools #3361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tools/ReleaseTools.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,12 @@ function Get-FirstChangelog {
[string]$RepositoryName
)
$Changelog = Get-Content -Path "$PSScriptRoot/../../$RepositoryName/$ChangelogFile"
# NOTE: The space after the header marker is important! Otherwise ### matches.
$Header = $Changelog.Where({$_.StartsWith("## ")}, "First")
$Changelog.Where(
{ $_.StartsWith("##") }, "SkipUntil"
{ $_ -eq $Header }, "SkipUntil"
).Where(
{ $_.StartsWith("##") }, "Until"
{ $_.StartsWith("## ") -and $_ -ne $Header }, "Until"
)
}

Expand Down Expand Up @@ -355,5 +357,3 @@ function New-DraftRelease {
Get-GitHubRepository -OwnerName PowerShell -RepositoryName $RepositoryName |
New-GitHubRelease @ReleaseParams
}

Export-ModuleMember -Function Update-Changelog, Update-Version, New-DraftRelease
37 changes: 1 addition & 36 deletions vscode-powershell.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -137,41 +137,6 @@ task UpdateReadme -If { $script:IsPreviewExtension } {
}
}

task UpdatePackageJson {
if ($script:IsPreviewExtension) {
$script:PackageJson.name = "powershell-preview"
$script:PackageJson.displayName = "PowerShell Preview"
$script:PackageJson.description = "(Preview) Develop PowerShell modules, commands and scripts in Visual Studio Code!"
$script:PackageJson.preview = $true
} else {
$script:PackageJson.name = "powershell"
$script:PackageJson.displayName = "PowerShell"
$script:PackageJson.description = "Develop PowerShell modules, commands and scripts in Visual Studio Code!"
$script:PackageJson.preview = $false
}

$currentVersion = [version](($script:PackageJson.version -split "-")[0])
$currentDate = Get-Date

$revision = if ($currentDate.Month -eq $currentVersion.Minor) {
$currentVersion.Build + 1
} else {
0
}

$script:PackageJson.version = "$($currentDate.ToString('yyyy.M')).$revision"

if ($env:TF_BUILD) {
$script:PackageJson.version += "-CI.$env:BUILD_BUILDID"
}

$Utf8NoBomEncoding = [System.Text.UTF8Encoding]::new($false)
[System.IO.File]::WriteAllLines(
(Resolve-Path "$PSScriptRoot/package.json").Path,
($script:PackageJson | ConvertTo-Json -Depth 100),
$Utf8NoBomEncoding)
}

task Package UpdateReadme, {
if ($script:psesBuildScriptPath -or $env:TF_BUILD) {
Write-Host "`n### Copying PowerShellEditorServices module files" -ForegroundColor Green
Expand All @@ -197,4 +162,4 @@ task Package UpdateReadme, {
# The set of tasks for a release
task Release Clean, Build, Package
# The default task is to run the entire CI build
task . CleanAll, BuildAll, Test, UpdatePackageJson, Package, UploadArtifacts
task . CleanAll, BuildAll, Test, Package, UploadArtifacts