This repository has been archived by the owner on Apr 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #905 from microsoft/update-azure-pipeline-to-master
Move from travis ci to azure pipeline in master branch
- Loading branch information
Showing
2 changed files
with
133 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,67 +1,119 @@ | ||
trigger: | ||
- master | ||
jobs: | ||
- job: Windows | ||
pool: | ||
name: Hosted VS2017 | ||
demands: npm | ||
steps: | ||
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: 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' | ||
- script: gts check | ||
displayName: 'check gts error' | ||
failOnStderr: True | ||
- script: node updateDynamicResourceLink.js | ||
displayName: 'Update link for code generator' | ||
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 | ||
**/*.vsix | ||
TargetFolder: '$(Build.ArtifactStagingDirectory)' | ||
condition: and(succeeded(), eq(variables['deploy_to_marketplace'], 'true')) | ||
|
||
- task: PublishBuildArtifacts@1 | ||
inputs: | ||
pathtoPublish: '$(Build.ArtifactStagingDirectory)' | ||
artifactName: drop1 | ||
- job: macOS | ||
pool: | ||
name: Hosted macOS | ||
demands: npm | ||
steps: | ||
- task: Npm@1 | ||
displayName: 'Install dependencies' | ||
inputs: | ||
verbose: false | ||
- task: Npm@1 | ||
displayName: 'Compile sources' | ||
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: | ||
command: custom | ||
verbose: false | ||
customCommand: 'run compile' | ||
- job: Linux | ||
pool: | ||
name: Hosted Ubuntu 1604 | ||
demands: npm | ||
steps: | ||
- task: Npm@1 | ||
displayName: 'Install dependencies' | ||
inputs: | ||
verbose: false | ||
- task: Npm@1 | ||
displayName: 'Compile sources' | ||
inputs: | ||
command: custom | ||
verbose: false | ||
customCommand: 'run compile' | ||
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters