vscode-cmake-tools/jobs/prerelease.yml

101 строка
3.8 KiB
YAML

# ==================================================================================
# Pipeline for prerelease
# ==================================================================================
trigger: none
schedules:
- cron: 0 4 * * 1,2,3,4,5
branches:
include:
- refs/heads/main
resources:
repositories:
- repository: self
type: git
ref: refs/heads/main
- repository: MicroBuildTemplate
type: git
name: 1ESPipelineTemplates/MicroBuildTemplate
ref: refs/tags/release
name: $(Date:yyyyMMdd).$(Rev:r)
variables:
- name: IsPreRelease
value: 1
- name: ReleaseVersion
value: unset
- name: TeamName
value: C++ Cross Platform and Cloud
- name: SignType
value: real
- name: Codeql.Language
value: javascript
extends:
template: azure-pipelines/MicroBuild.1ES.Official.yml@MicroBuildTemplate
parameters:
pool:
name: VSEngSS-MicroBuild2022-1ES
sdl:
sourceAnalysisPool:
name: VSEngSS-MicroBuild2022-1ES
customBuildTags:
- ES365AIMigrationTooling
stages:
- stage: stage
jobs:
- job: Job_1
displayName: Build pre-release
templateContext:
outputs:
- output: pipelineArtifact
displayName: 'Publish VSIX'
targetPath: $(Build.ArtifactStagingDirectory)/vsix
artifactName: vsix
sbomBuildDropPath: $(Build.ArtifactStagingDirectory)
steps:
- checkout: self
clean: true
fetchTags: false
- task: PowerShell@2
displayName: Update ReleaseVersion for pre-release builds
condition: eq(variables.IsPreRelease, '1')
inputs:
targetType: inline
script: |
#
# Query the Marketplace for the latest version of CMake Tools
# https://github.com/microsoft/vscode/blob/main/src/vs/platform/extensionManagement/common/extensionGalleryService.ts
#
$uri = 'https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery'
$contentType = 'application/json'
$headers = @{
"Accept" = "application/json; api-version=3.0-preview"
}
$data = '{"filters": [{"criteria": [{"filterType": 7, "value": "ms-vscode.cmake-tools"}]}], "flags": 529}'
$response = Invoke-WebRequest -Method 'POST' -Uri $uri -UseBasicParsing -ContentType $contentType -Headers $headers -Body $data
$newVersion = ''
if ($response.StatusCode.Equals(200)) {
$result = $response.Content | ConvertFrom-Json
# Check the $result.results[0].extensions.versions.properties for the 'Microsoft.VisualStudio.Code.PreRelease' key to make sure it's true,
# if not, we need to bump the .Minor version and reset .Build to 0
$index = $result.results[0].extensions.versions.properties.key.IndexOf("Microsoft.VisualStudio.Code.PreRelease")
$isPreRelease = "false"
if ($index -ge 0) {
$isPreRelease = $result.results[0].extensions.versions.properties.value[$index]
}
$v = [System.Version]::Parse($result.results[0].extensions.versions.version)
if ($isPreRelease.Equals('true')) {
$newVersion = [System.Version]::new($v.Major, $v.Minor, $v.Build + 1).ToString()
} else {
$newVersion = [System.Version]::new($v.Major, $v.Minor + 1, 0).ToString()
}
}
Write-Host "New version is: $newVersion"
Write-Host "##vso[task.setvariable variable=ReleaseVersion]$newVersion"
ignoreLASTEXITCODE: true
- template: /jobs/shared/build.yml@self
parameters:
ReleaseVersion: $(ReleaseVersion)