131 строка
4.5 KiB
YAML
131 строка
4.5 KiB
YAML
trigger:
|
|
branches:
|
|
include:
|
|
- master
|
|
- develop
|
|
tags:
|
|
include:
|
|
- v*
|
|
|
|
strategy:
|
|
matrix:
|
|
linux:
|
|
imageName: "ubuntu-16.04"
|
|
mac:
|
|
imageName: "macos-10.13"
|
|
windows:
|
|
imageName: "vs2017-win2016"
|
|
|
|
pool:
|
|
vmImage: $(imageName)
|
|
demands: npm
|
|
|
|
variables:
|
|
nightly_build_id: iotdevexbuild.test-owl-project-nightly
|
|
rc_id: iotdevexbuild.test-owl-project
|
|
|
|
steps:
|
|
|
|
- task: UseNode@1
|
|
displayName: 'Install node version >=12.0.0'
|
|
inputs:
|
|
version: '>=12.0.0'
|
|
|
|
- task: Npm@1
|
|
displayName: 'Install dependencies'
|
|
inputs:
|
|
verbose: false
|
|
|
|
- script: node node_modules/gts/build/src/cli.js check
|
|
displayName: 'check gts error'
|
|
failOnStderr: True
|
|
|
|
- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2
|
|
displayName: 'Run CredScan'
|
|
inputs:
|
|
debugMode: false
|
|
condition: eq(variables['Agent.OS'], 'Windows_NT')
|
|
|
|
- task: securedevelopmentteam.vss-secure-development-tools.build-task-policheck.PoliCheck@1
|
|
displayName: 'Run PoliCheck'
|
|
inputs:
|
|
targetType: F
|
|
condition: eq(variables['Agent.OS'], 'Windows_NT')
|
|
|
|
- task: Npm@1
|
|
displayName: 'Compile sources'
|
|
inputs:
|
|
command: custom
|
|
verbose: false
|
|
customCommand: 'run compile'
|
|
|
|
- bash: |
|
|
is_prod_tag=^refs\/tags\/v?[0-9]+\.[0-9]+\.[0-9]+$
|
|
is_test_tag=^refs\/tags\/v?[0-9]+\.[0-9]+\.[0-9]+-[rR][cC]
|
|
|
|
[[ $BUILD_SOURCEBRANCH =~ $is_prod_tag ]] && is_prod=true
|
|
[[ $BUILD_SOURCEBRANCH =~ $is_test_tag ]] && is_test=true
|
|
[[ $BUILD_SOURCEBRANCH =~ $is_prod_tag || $BUILD_SOURCEBRANCH =~ $is_test_tag || "$BUILD_REASON" == "Schedule" ]] && deploy_to_marketplace=true
|
|
|
|
# Set job variable
|
|
echo "##vso[task.setvariable variable=is_prod]$is_prod"
|
|
echo "##vso[task.setvariable variable=is_test]$is_test"
|
|
echo "##vso[task.setvariable variable=deploy_to_marketplace]$deploy_to_marketplace"
|
|
displayName: 'Define runtime variable'
|
|
|
|
- script: npm install -g vsce
|
|
displayName: 'install vsce'
|
|
condition: and(succeeded(), eq(variables['deploy_to_marketplace'], 'true'))
|
|
|
|
- script: node scripts/updateConfig.js
|
|
displayName: 'Update configuration'
|
|
condition: and(succeeded(), eq(variables['deploy_to_marketplace'], 'true'))
|
|
|
|
- script: vsce package
|
|
displayName: 'Build VSIX package'
|
|
condition: and(succeeded(), eq(variables['deploy_to_marketplace'], 'true'))
|
|
|
|
- task: CopyFiles@2
|
|
inputs:
|
|
SourceFolder: '$(System.DefaultWorkingDirectory)'
|
|
Contents: |
|
|
**/*.vsix
|
|
TargetFolder: '$(Build.ArtifactStagingDirectory)'
|
|
condition: and(succeeded(), eq(variables['deploy_to_marketplace'], 'true'))
|
|
|
|
- task: PublishBuildArtifacts@1
|
|
inputs:
|
|
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
|
|
artifactName: $(Agent.OS)-drop
|
|
condition: and(succeeded(), eq(variables['deploy_to_marketplace'], 'true'))
|
|
|
|
- task: GitHubRelease@0
|
|
displayName: 'Deploy production or RC candidate to GitHub Release'
|
|
inputs:
|
|
gitHubConnection: 'pat_for_github_release_deployment'
|
|
repositoryName: '$(Build.Repository.Name)'
|
|
action: 'create'
|
|
target: '$(Build.SourceVersion)'
|
|
isPreRelease: $(is_test)
|
|
condition: and(succeeded(), eq(variables['deploy_to_marketplace'], 'true'), ne(variables['Build.reason'], 'Schedule'), eq(variables['Agent.OS'], 'Linux'))
|
|
|
|
- bash: vsce publish -p $MARKETPLACE_TOKEN --packagePath *.vsix
|
|
workingDirectory: '$(Build.ArtifactStagingDirectory)'
|
|
displayName: 'Deploy production candidate to marketplace'
|
|
condition: and(succeeded(), eq(variables['is_prod'], 'true'), eq(variables['Agent.OS'], 'Linux'))
|
|
env:
|
|
MARKETPLACE_TOKEN: $(vsciot_marketplace_token)
|
|
|
|
- bash: yes | vsce unpublish -p $MARKETPLACE_TOKEN $(rc_id) && vsce publish -p $MARKETPLACE_TOKEN --packagePath *.vsix
|
|
workingDirectory: '$(Build.ArtifactStagingDirectory)'
|
|
displayName: 'Deploy RC candidate to marketplace'
|
|
condition: and(succeeded(), eq(variables['is_test'], 'true'), eq(variables['Agent.OS'], 'Linux'))
|
|
env:
|
|
MARKETPLACE_TOKEN: $(iotdevexbuild_marketplace_token)
|
|
|
|
- bash: yes | vsce unpublish -p $MARKETPLACE_TOKEN $(nightly_build_id) && vsce publish -p $MARKETPLACE_TOKEN --packagePath *.vsix
|
|
workingDirectory: '$(Build.ArtifactStagingDirectory)'
|
|
displayName: 'Deploy nightly build candidate to marketplace'
|
|
condition: and(succeeded(), eq(variables['Build.reason'], 'Schedule'), eq(variables['Agent.OS'], 'Linux'))
|
|
env:
|
|
MARKETPLACE_TOKEN: $(iotdevexbuild_marketplace_token) |