-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathazure-pipelines.yml
109 lines (93 loc) · 3.1 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
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
name: $(Date:yyMMdd)$(Rev:.r)
pool:
vmImage: 'windows-latest'
variables:
ReleaseNo: '4.2.{Date}'
parameters:
- name: BuildType
displayName: Type of build
type: string
default: Internal
values:
- Internal
- Release
steps:
- checkout: self
persistCredentials: true
- task: DownloadPipelineArtifact@2
displayName: Download CSV RefBuilder
inputs:
buildType: 'specific'
project: 'VERA-standaard'
definition: '19'
buildVersionToDownload: 'latest'
targetPath: '$(Pipeline.Workspace)'
- task: ExtractFiles@1
displayName: Extract CSV RefBuilder Artifact
inputs:
archiveFilePatterns: '$(Pipeline.Workspace)/vera-csvrefbuilder/vera-csvrefbuilder.7z'
destinationFolder: '$(Pipeline.Workspace)/vera-csvrefbuilder/bin'
cleanDestinationFolder: true
overwriteExistingFiles: true
- task: CmdLine@2
displayName: Run CSV Builder
inputs:
script: |
echo 'Building Wiki CSV import files ...'
mkdir %Build_ArtifactStagingDirectory%\out
$(Pipeline.Workspace)/vera-csvrefbuilder/bin/net6.0/vera-csvrefbuilder.exe -i $(Build.Repository.LocalPath)\Referentiedata.csv -o $(Build.ArtifactStagingDirectory)\out\wiki-referentiedata.csv
IF %errorlevel% NEQ 0 GOTO :error
GOTO :end
:error
echo vera-csvrefbuilder.exe failed with exitcode %errorlevel%
EXIT 1
:end
echo 'Done'
- task: PublishBuildArtifacts@1
displayName: Publish CSV Builder Artifacts (Wiki XL)
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)\out'
FileCopyOptions: '**/*'
ArtifactName: CSV-Bestanden
- ${{ if eq(parameters.BuildType,'Release') }}:
- task: PowerShell@2
displayName: Set release number
inputs:
targetType: inline
script: |
$ReleaseNo = ($ENV:RELEASENO -replace "{Date}",(get-date -format 'yyMMdd'))
write-host "##vso[task.setvariable variable=ReleaseNo]$ReleaseNo"
- script: |
echo Change git config
git config --global user.email "devops@stichting-vera.nl"
git config --global user.name "devops"
echo Remove tag from remote
git push origin :refs/tags/v%RELEASENO%
echo Create tag v%RELEASENO%
git tag -f v%RELEASENO%
IF %errorlevel% NEQ 0 GOTO :error
echo Push tag v%RELEASENO%
git push origin --tags
IF %errorlevel% NEQ 0 GOTO :error
GOTO :end
:error
echo git failed with exitcode %errorlevel%
EXIT 1
:end
echo 'Done'
displayName: Create and push tag
workingDirectory: '$(Build.Repository.LocalPath)'
- task: GitHubRelease@1
displayName: 'Create GitHub release'
inputs:
gitHubConnection: 'github.com_RonKopp'
repositoryName: 'Aedes-datastandaarden/vera-referentiedata'
target: '$(Build.SourceVersion)'
tagSource: userSpecifiedTag
tag: 'v$(ReleaseNo)'
title: 'Release $(ReleaseNo)'
addChangeLog: true