-
Notifications
You must be signed in to change notification settings - Fork 5
/
azure-pipelines.yml
183 lines (157 loc) · 5.25 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
variables:
- name: Version
value: '1.2'
name: $(Version).$(BuildID)
trigger:
- master
resources:
repositories:
- repository: diagram-frame-releases
type: github
name: nbelyh/diagram-frame-releases
endpoint: github.com_nbelyh
ref: main
stages:
- stage: 'build'
displayName: 'build'
jobs:
- job: 'build'
pool:
vmImage: 'ubuntu-latest'
demands:
- npm
- node.js
variables:
npm_config_cache: $(Pipeline.Workspace)/.npm
steps:
- task: NodeTool@0
displayName: 'Use Node 16.x'
inputs:
versionSpec: 16.x
- script: npm ci
displayName: 'npm ci'
- script: npm version --no-git-tag-version --commit-hooks false "$(Build.BuildNumber)"
displayName: 'Set App Version'
- task: gulp@1
displayName: 'Update version in source files'
inputs:
targets: 'update-version'
- script: npm test
displayName: 'npm test'
- task: gulp@1
displayName: 'Bundle NO-CDN versopm'
inputs:
targets: bundle
arguments: '--ship'
- task: gulp@1
displayName: 'Package NO-CDN version'
inputs:
targets: 'package-solution'
arguments: '--ship'
- task: CopyFiles@2
displayName: 'Copy SPFx files to artifcacts'
inputs:
Contents: sharepoint/**/*.sppkg
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: gulp@1
displayName: 'Cleanup'
inputs:
targets: 'full-clean'
- task: gulp@1
displayName: 'Target CDN'
inputs:
targets: 'target-cdn'
- task: gulp@1
displayName: 'Bundle CDN version'
inputs:
targets: bundle
arguments: '--ship'
- task: gulp@1
displayName: 'Package CDN version'
inputs:
targets: 'package-solution'
arguments: '--ship'
- task: CopyFiles@2
displayName: 'Copy SPFx files to artifcacts'
inputs:
Contents: sharepoint/**/*.sppkg
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: CopyFiles@2
displayName: 'Copy CDN files to artifacts'
inputs:
Contents: dist/**/*
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: CopyFiles@2
displayName: 'Copy docs files to artifacts'
inputs:
Contents: docs/**/*
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
- stage: GitHubRelease
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
pool:
vmImage: 'windows-latest'
jobs:
- deployment: GitHubRelease
environment: 'github'
strategy:
runOnce:
deploy:
steps:
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'drop'
downloadPath: '$(System.ArtifactsDirectory)'
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
$versionFull = "$(Build.BuildNumber)"
$version = $versionFull|%{[System.Version]$_}
$versionShort = "$($version.Major).$($version.Minor)"
Write-Host "##vso[task.setvariable variable=versionShort]$($versionShort)"
- checkout: diagram-frame-releases
path: diagram-frame-releases
persistCredentials: true
- task: PowerShell@2
displayName: 'Git pull'
inputs:
targetType: 'inline'
workingDirectory: '$(Agent.BuildDirectory)/diagram-frame-releases'
script: |
git fetch
git checkout main
git pull
- task: CopyFiles@2
displayName: 'Copy build artifacts to releases repo'
inputs:
SourceFolder: '$(System.ArtifactsDirectory)/drop/dist'
Contents: '**'
TargetFolder: '$(Agent.BuildDirectory)/diagram-frame-releases/$(versionShort)'
- task: PowerShell@2
displayName: 'Git commit'
inputs:
targetType: 'inline'
workingDirectory: '$(Agent.BuildDirectory)/diagram-frame-releases'
script: |
git config user.email "[email protected]"
git config user.name "Azure Pipelines Build"
git add .
git commit -m "Release $(Build.BuildNumber)"
git push origin main
- task: GitHubRelease@1
inputs:
gitHubConnection: 'github.com_nbelyh'
repositoryName: '$(Build.Repository.Name)'
action: 'edit'
target: '$(Build.SourceVersion)'
tag: '$(versionShort)'
title: '$(Build.BuildNumber)'
releaseNotesFilePath: '$(System.ArtifactsDirectory)/drop/docs/release-notes-$(versionShort).md'
assets: '$(System.ArtifactsDirectory)/drop/sharepoint/solution/*.sppkg'
isPreRelease: true
changeLogCompareToRelease: 'lastFullRelease'
changeLogType: 'commitBased'