-
Notifications
You must be signed in to change notification settings - Fork 3
/
azure-pipelines.yml
99 lines (80 loc) · 2.95 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
variables:
GH_TOKEN: $(ghToken)
YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn
trigger:
batch: true
branches:
include:
- master
pr:
- master
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self
persistCredentials: true
- task: NodeTool@0
inputs:
versionSpec: '16.x'
displayName: 'Install Node.js'
- task: Cache@2
inputs:
key: 'yarn | "$(Agent.OS)" | yarn.lock'
path: '$(YARN_CACHE_FOLDER)'
- task: Bash@3
inputs:
targetType: 'inline'
script: 'yarn install --frozen-lockfile'
displayName: 'yarn install ignoring scripts'
- task: Bash@3
inputs:
targetType: 'inline'
script: 'yarn build'
displayName: 'yarn build'
- task: Bash@3
inputs:
targetType: 'inline'
script: 'yarn test'
displayName: 'yarn test'
# - task: Bash@3
# inputs:
# targetType: 'inline'
# script: 'CODECOV_TOKEN=$(CODECOV_TOKEN) yarn codecov'
# displayName: 'yarn codecov'
- powershell: |
$git = git config --global core.safecrlf false
Write-Output $git
$yarn = yarn cross-env GH_TOKEN=$(GH_TOKEN) CI=true GIT_USERNAME=marceloavf-bot [email protected] semantic-release
Write-Output $yarn
# Add a build tag if version is bumped
if ($yarn -match "The next release version is") {
Write-Host "##vso[build.addbuildtag]release"
Write-Output ("##vso[task.setvariable variable=ShouldRelease;]true")
} else {
Write-Output "No Bump, this build don't need to be released"
}
displayName: '(only master) Yarn run semantic-release and add tag "release" if necessary'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
- powershell: |
$package_version = (Get-Content -Raw -Path package.json | ConvertFrom-Json).version
Write-Output "Setting version '$package_version'."
Write-Host "##vso[build.updatebuildnumber]$package_version"
displayName: '(only master) Package version'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
- bash: yarn package --version $(Build.BuildNumber) --noversiontransform
displayName: '(only when bump version) Yarn package'
condition: and(succeeded(), eq(variables['ShouldRelease'], 'true'))
- task: CopyFiles@2
displayName: '(only when bump version) Copy Files to: $(build.artifactstagingdirectory)'
inputs:
SourceFolder: '$(Build.SourcesDirectory)/.BuildOutput/'
Contents: '**/*.vsix'
TargetFolder: '$(build.artifactstagingdirectory)'
CleanTargetFolder: true
condition: and(succeeded(), eq(variables['ShouldRelease'], 'true'))
- task: PublishBuildArtifacts@1
displayName: '(only when bump version) Publish Artifact: digitalocean-tools-vsts'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: 'digitalocean-tools-vsts'
condition: and(succeeded(), eq(variables['ShouldRelease'], 'true'))