Skip to content

Update version only in CI #1979

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
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "powershell-preview",
"displayName": "PowerShell Preview",
"version": "2.0.0-preview.3",
"version": "2019.5.0",
"preview": true,
"publisher": "ms-vscode",
"description": "(Preview) Develop PowerShell scripts in Visual Studio Code!",
Expand Down
18 changes: 13 additions & 5 deletions vscode-powershell.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ task UpdateReadme -If { $script:PackageJson.version -like "*preview*" } {
}

task UpdatePackageJson {
if ($script:PackageJson.version -like "*preview*") {
if ($script:PackageJson.name -like "*preview*" -or $script:PackageJson.displayName -like "*preview*") {
$script:PackageJson.name = "powershell-preview"
$script:PackageJson.displayName = "PowerShell Preview"
$script:PackageJson.description = "(Preview) Develop PowerShell scripts in Visual Studio Code!"
Expand All @@ -151,8 +151,16 @@ task UpdatePackageJson {
$script:PackageJson.preview = $false
}

$revision = if ($env:BUILD_BUILDID) { $env:BUILD_BUILDID } else { 9999 }
$script:PackageJson.version = "$(Get-Date -Format 'yyyy.M').$revision"
$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"

$Utf8NoBomEncoding = [System.Text.UTF8Encoding]::new($false)
[System.IO.File]::WriteAllLines(
Expand All @@ -161,7 +169,7 @@ task UpdatePackageJson {
$Utf8NoBomEncoding)
}

task Package UpdateReadme, UpdatePackageJson, {
task Package UpdateReadme, {

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