-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
40 lines (40 loc) · 1.31 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
name: $(Build.SourceBranch)$(rev:.r)
trigger:
- releases/*
steps:
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
#Obtem a build number, que contém o nome da branch
$v = ($env:BUILD_BUILDNUMBER)
#substitui o que não interessa
$v = $v.replace('refs_', '')
$v = $v.replace('heads_', '')
$v = $v.replace('releases_','')
#se o resultado não está no padrão X.X.X, adiciono 0.0.0 a frente
echo $v
if($v -notmatch '^\d+\.\d+.\d+'){
$v = '0.0.0-' + $v
}
echo "##vso[task.setvariable variable=version;isOutput=true]$v"
echo 'version has been set ' $v
name: 'SetVersionStep'
displayName: 'Determinando versão'
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
(Get-Content ./package.json) | ForEach-Object { $_ -replace "0.0.0", "$(SetVersionStep.version)" } | Set-Content ./package.json
(Get-Content ./index.js) | ForEach-Object { $_ -replace "0.0.0", "$(SetVersionStep.version)" } | Set-Content ./index.js
displayName: 'Alterando versão no package.json e no index.js'
- task: Npm@1
inputs:
command: 'install'
- task: Npm@1
inputs:
command: 'custom'
customCommand: 'pack'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: 'guimabdo-guidotnet-$(SetVersionStep.version).tgz'