-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
118 lines (115 loc) · 4.53 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# name: $(majorVersion).$(minorVersion).$(patchVersion)$(channelVersion)$(buildVersion)$(Rev:.r)
trigger:
branches:
include:
- master
tags:
include:
- v*
pool:
vmImage: "ubuntu-18.04"
stages:
- stage: Build
jobs:
- job: Package
steps:
- task: UseGitVersion@5
displayName: "Git Version"
inputs:
versionSpec: "5.0.0"
useConfigFile: true
configFilePath: "$(Build.SourcesDirectory)/GitVersion.yml"
- task: Yarn@3
displayName: "Install"
inputs:
ProjectDirectory: $(Build.SourcesDirectory)
- task: Yarn@3
displayName: "Update version"
inputs:
arguments: "version --new-version $(Build.BuildNumber) --no-git-tag-version"
ProjectDirectory: $(Build.SourcesDirectory)
- task: SonarCloudPrepare@1
displayName: 'Prepare analysis configuration'
inputs:
SonarCloud: 'SonarCloud'
organization: 'mocoding'
scannerMode: 'CLI'
configMode: 'manual'
cliProjectKey: 'mocoding-software_odata-client'
cliProjectName: 'odata-client'
cliSources: 'src'
extraProperties: |
# Additional properties that will be passed to the scanner,
# Put one key=value per line, example:
# sonar.exclusions=**/*.bin
sonar.tests=test
sonar.test.inclusions=**/*.spec.ts
sonar.testExecutionReportPaths=$(Build.SourcesDirectory)/.coverage/test-report.xml
sonar.typescript.lcov.reportPaths=$(Build.SourcesDirectory)/.coverage/lcov.info
- task: Yarn@3
displayName: "Pack"
condition:
inputs:
arguments: "pack --filename $(Build.StagingDirectory)/odata-client-$(Build.BuildNumber).tgz"
projectDirectory: "$(Build.SourcesDirectory)/packages/odata-client"
- task: PublishBuildArtifacts@1
displayName: "Publish"
inputs:
PathtoPublish: "$(Build.StagingDirectory)/odata-client-$(Build.BuildNumber).tgz"
ArtifactName: npm
- task: SonarCloudAnalyze@1
displayName: 'Run SonarCloud analysis'
- task: SonarCloudPublish@1
displayName: 'Publish results on build summary'
inputs:
pollingTimeoutSec: '300'
- task: PublishCodeCoverageResults@1
displayName: "Publich Code Coverage"
inputs:
codeCoverageTool: "Cobertura"
summaryFileLocation: "$(Build.SourcesDirectory)/.coverage/cobertura-coverage.xml"
condition: succeededOrFailed()
- stage: Deploy
dependsOn: Build
condition: and(succeeded(), contains(variables['Build.Reason'], 'PullRequest'))
jobs:
- deployment: DevBuild
environment: "dev-builds"
strategy:
runOnce:
deploy:
steps:
- task: Npm@1
displayName: "Publish to npm (dev-builds)"
inputs:
command: "custom"
customCommand: "publish $(Pipeline.Workspace)/npm/odata-client-$(Build.BuildNumber).tgz"
customRegistry: "useFeed"
customFeed: "da7703d4-fb22-4933-b869-83f4264b7b84/e1336e71-3540-4a0c-830c-639112685b07"
- stage: Release
dependsOn: Build
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'tags/v'))
pool:
vmImage: "ubuntu-18.04"
jobs:
- deployment: Public
environment: "public"
strategy:
runOnce:
deploy:
steps:
- task: GitHubRelease@1
displayName: "Update GitHub release"
inputs:
gitHubConnection: "mocoding-software"
repositoryName: "mocoding-software/odata-client"
action: edit
tag: "v$(Build.BuildNumber)"
assets: "$(Pipeline.Workspace)/**/*.tgz"
assetUploadMode: replace
- task: Npm@1
displayName: "Publish to npm"
inputs:
command: "custom"
customCommand: "publish --access public $(Pipeline.Workspace)/npm/odata-client-$(Build.BuildNumber).tgz"
customEndpoint: "public-npm"