-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathazure-pipelines.yml
77 lines (72 loc) · 3.19 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Copyright (c) Microsoft Corporation.
name: $(Date:yyyyMMdd)$(Rev:.r).0-$(SourceBranchName)
parameters:
- name: SignTypeOverride
displayName: Signing Type Override
type: string
default: default
values:
- default
- test
- real
pr:
- main
trigger:
branches:
include:
- main
variables:
# If the user didn't override the signing type, then only real-sign on main.
${{ if ne(parameters.SignTypeOverride, 'default') }}:
SignType: ${{ parameters.SignTypeOverride }}
${{ if and(eq(parameters.SignTypeOverride, 'default'), or(startsWith(variables['Build.SourceBranch'], 'refs/tags'), eq(variables['Build.SourceBranchName'], 'main'))) }}:
SignType: real
${{ if and(eq(parameters.SignTypeOverride, 'default'), not(or(startsWith(variables['Build.SourceBranch'], 'refs/tags'), eq(variables['Build.SourceBranchName'], 'main')))) }}:
SignType: test
jobs:
- template: jobs/shared/build.yml
- job: GetNpmPackageVersions
dependsOn: Build
displayName: Extract npm package versions into variables
steps:
- script: echo "##vso[task.setvariable variable=CurrentVersion;isoutput=true]$(npm view @microsoft/vscode-serial-monitor-api version)"
name: currentVersionCheck
- script: echo "##vso[task.setvariable variable=NewVersion;isoutput=true]$(node getCurrentPackageJsonVersion.js)"
name: newVersionCheck
- job: WaitForNPMPublishValidation
displayName: Wait for publishing npm package validation
dependsOn: [GetNpmPackageVersions, Build]
pool: server
variables:
currentVersion: $[dependencies.GetNpmPackageVersions.outputs['currentVersionCheck.CurrentVersion']]
newVersion: $[dependencies.GetNpmPackageVersions.outputs['newVersionCheck.NewVersion']]
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), gt(variables['newVersion'], variables['currentVersion']))
steps:
- task: ManualValidation@0
inputs:
notifyUsers: embeddeddev@microsoft.com
instructions: "Please validate the vscode-serial-monitor-api npm package release. After validation, resume the pipeline."
- job: Publish
displayName: Publish the npm package
dependsOn: [WaitForNPMPublishValidation, GetNpmPackageVersions]
pool:
name: AzurePipelines-EO
variables:
TeamName: C++ Cross Platform and Cloud
currentVersion: $[dependencies.GetNpmPackageVersions.outputs['currentVersionCheck.CurrentVersion']]
newVersion: $[dependencies.GetNpmPackageVersions.outputs['newVersionCheck.NewVersion']]
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), gt(variables['newVersion'], variables['currentVersion']))
steps:
- checkout: self
persistCredentials: "true"
- download: current
artifact: npm-package
- template: jobs/shared/install-node.yml
- script: |
git tag v$(newVersion)
git push origin v$(newVersion)
displayName: Push version tag to git
- bash: cd $(Pipeline.Workspace)/npm-package && npm publish microsoft-vscode-serial-monitor-api-*.*.*.tgz --userconfig $(Build.SourcesDirectory)/.npmrc
displayName: Publish to npm
env:
NODE_AUTH_TOKEN: $(NPM_TOKEN)