-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate-artifact-pipeline.yml
121 lines (106 loc) · 3.41 KB
/
create-artifact-pipeline.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
parameters:
- name: buildVersion
type: string
default: '0.0.0.0'
trigger:
batch: true
branches:
include:
- main
paths:
include:
- OmadaWeb.PS/**
pool:
name: PH
variables:
buildConfiguration: 'Pipeline'
buildVersion: 'Will be set dynamically'
year: 'Will be set dynamically'
revision: $[counter(format('{0:dd}', pipeline.startTime), 1)]
stages:
- stage: BuildStage
jobs:
- job: BuildJob
steps:
- task: PowerShell@2
displayName: 'Install Modules'
name: "InstallModules"
inputs:
filePath: '$(System.DefaultWorkingDirectory)/Build/InstallModules.ps1'
pwsh: true
failOnStderr: true
condition: succeeded()
- task: PowerShell@2
displayName: 'Preparing Build Number'
name: BuildVersioning
inputs:
filePath: '$(System.DefaultWorkingDirectory)/Build/BuildVersioning.ps1'
pwsh: true
failOnStderr: true
condition: succeeded()
- task: PowerShell@2
displayName: 'Build Module'
name: "BuildTask"
inputs:
filePath: '$(System.DefaultWorkingDirectory)/Build/build.ps1'
arguments: ' -Task Build -BuildVersion $(BuildVersioning.buildVersion)'
pwsh: true
failOnStderr: true
condition: succeeded()
- task: PublishPipelineArtifact@1
displayName: 'Publish Build Output'
inputs:
targetPath: '$(System.DefaultWorkingDirectory)/buildoutput'
artifactName: 'BuildOutput'
condition: succeeded()
- stage: PackageStage
dependsOn: [BuildStage]
jobs:
- job: 'Create_Artifacts'
variables:
buildVersion: $[ stageDependencies.BuildStage.BuildJob.outputs['BuildVersioning.buildVersion'] ]
year: $[ stageDependencies.BuildStage.BuildJob.outputs['BuildVersioning.year'] ]
steps:
- checkout: self
path: 'OmadaWeb.PS'
persistCredentials: true
clean: true
- task: DownloadPipelineArtifact@2
displayName: 'Download Build Output'
inputs:
artifactName: 'BuildOutput'
targetPath: '$(System.DefaultWorkingDirectory)/buildoutput'
- task: NuGetCommand@2
displayName: 'Pack project'
inputs:
command: pack
packagesToPack: '$(System.DefaultWorkingDirectory)/OmadaWeb.PS.nuspec'
packDestination: '$(Build.ArtifactStagingDirectory)'
versioningScheme: byEnvVar
versionEnvVar: buildVersion
buildProperties: 'VERSION=$(buildVersion);YEAR=$(year)'
condition: succeededOrFailed()
- task: NuGetCommand@2
displayName: 'NuGet push'
inputs:
command: push
nuGetFeedType: internal
publishVstsFeed: 'Fortigi-Generic/OmadaWeb.PS'
allowPackageConflicts: true
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
condition: succeeded()
continueOnError: false
- task: CmdLine@2
displayName: 'Create Tag'
inputs:
script: |
echo "Create tag: $(buildVersion)"
git config --global user.email "devops@fortigi.nl"
git config --global user.name "Azure DevOps Pipeline"
git tag -a v$(buildVersion) -m "Release version $(buildVersion)"
git push origin refs/tags/v$(buildVersion) 2>stderr.log
type stderr.log
failOnStderr: false
workingDirectory: $(Build.SourcesDirectory)
condition: succeeded()
enabled: true