Skip to content

Commit 8037ffc

Browse files
[ignore] Update version only in CI (#1979)
* Update version on in CI * add CI prereleaseTag
1 parent 728b5e4 commit 8037ffc

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

package.json

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

vscode-powershell.build.ps1

+17-5
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ task UpdateReadme -If { $script:PackageJson.version -like "*preview*" } {
139139
}
140140

141141
task UpdatePackageJson {
142-
if ($script:PackageJson.version -like "*preview*") {
142+
if ($script:PackageJson.name -like "*preview*" -or $script:PackageJson.displayName -like "*preview*") {
143143
$script:PackageJson.name = "powershell-preview"
144144
$script:PackageJson.displayName = "PowerShell Preview"
145145
$script:PackageJson.description = "(Preview) Develop PowerShell scripts in Visual Studio Code!"
@@ -151,8 +151,20 @@ task UpdatePackageJson {
151151
$script:PackageJson.preview = $false
152152
}
153153

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

157169
$Utf8NoBomEncoding = [System.Text.UTF8Encoding]::new($false)
158170
[System.IO.File]::WriteAllLines(
@@ -161,7 +173,7 @@ task UpdatePackageJson {
161173
$Utf8NoBomEncoding)
162174
}
163175

164-
task Package UpdateReadme, UpdatePackageJson, {
176+
task Package UpdateReadme, {
165177

166178
if ($script:psesBuildScriptPath) {
167179
Write-Host "`n### Copying PowerShellEditorServices module files" -ForegroundColor Green
@@ -186,4 +198,4 @@ task Package UpdateReadme, UpdatePackageJson, {
186198
# The set of tasks for a release
187199
task Release Clean, Build, Test, Package
188200
# The default task is to run the entire CI build
189-
task . CleanAll, BuildAll, Test, Package, UploadArtifacts
201+
task . CleanAll, BuildAll, Test, UpdatePackageJson, Package, UploadArtifacts

0 commit comments

Comments
 (0)