Skip to content

Commit 1b5cdfa

Browse files
[Ignore] Update version only in CI (#1980)
1 parent 9638636 commit 1b5cdfa

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "powershell",
33
"displayName": "PowerShell",
4-
"version": "1.12.1",
4+
"version": "2019.5.0",
55
"preview": false,
66
"publisher": "ms-vscode",
77
"description": "Develop PowerShell scripts in Visual Studio Code!",

vscode-powershell.build.ps1

+18-5
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ task UpdateReadme -If { $script:PackageJson.version -like "*preview*" } {
135135
}
136136

137137
task UpdatePackageJson {
138-
if ($script:PackageJson.version -like "*preview*") {
138+
if ($script:PackageJson.name -like "*preview*" -or $script:PackageJson.displayName -like "*preview*") {
139139
$script:PackageJson.name = "powershell-preview"
140140
$script:PackageJson.displayName = "PowerShell Preview"
141141
$script:PackageJson.description = "(Preview) Develop PowerShell scripts in Visual Studio Code!"
@@ -147,16 +147,29 @@ task UpdatePackageJson {
147147
$script:PackageJson.preview = $false
148148
}
149149

150-
$revision = if ($env:BUILD_BUILDID) { $env:BUILD_BUILDID } else { 9999 }
151-
$script:PackageJson.version = "$(Get-Date -Format 'yyyy.M').$revision"
150+
$currentVersion = [version](($script:PackageJson.version -split "-")[0])
151+
$currentDate = Get-Date
152+
153+
$revision = if ($currentDate.Month -eq $currentVersion.Minor) {
154+
$currentVersion.Build + 1
155+
} else {
156+
0
157+
}
158+
159+
$script:PackageJson.version = "$($currentDate.ToString('yyyy.M')).$revision"
160+
161+
if ($env:TF_BUILD) {
162+
$script:PackageJson.version += "-CI.$env:BUILD_BUILDID"
163+
}
152164

153165
$Utf8NoBomEncoding = [System.Text.UTF8Encoding]::new($false)
154166
[System.IO.File]::WriteAllLines(
155167
(Resolve-Path "$PSScriptRoot/package.json").Path,
156168
($script:PackageJson | ConvertTo-Json -Depth 100),
157169
$Utf8NoBomEncoding)
158170
}
159-
task Package UpdateReadme, UpdatePackageJson, {
171+
172+
task Package UpdateReadme, {
160173

161174
if ($script:psesBuildScriptPath) {
162175
Write-Host "`n### Copying PowerShellEditorServices module files" -ForegroundColor Green
@@ -181,4 +194,4 @@ task Package UpdateReadme, UpdatePackageJson, {
181194
# The set of tasks for a release
182195
task Release Clean, Build, Test, Package
183196
# The default task is to run the entire CI build
184-
task . Clean, BuildAll, Test, Package, UploadArtifacts
197+
task . Clean, BuildAll, Test, UpdatePackageJson, Package, UploadArtifacts

0 commit comments

Comments
 (0)