forked from zmaske/one
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
114 lines (99 loc) · 3.75 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
name: $(TeamProject)_$(BuildDefinitionName)_$(SourceBranchName)_$(Date:yy).$(Date:MMdd)$(Rev:.r)
variables:
SolutionFile: one.sln
BuildConfiguration: Release
VersionPrefix: '0'
BuildYear: $[format('{0:yy}', pipeline.startTime)]
BuildDate: $[format('{0:MMdd}', pipeline.startTime)]
Revision: 0
VersionExt: '0.0.0.0'
stages:
- stage: Build
jobs:
- job: DotNetBuild
pool:
name: Hosted Windows 2019 with VS2019
#name: Default
steps:
- powershell: |
$buildNumber = $Env:BUILD_BUILDNUMBER
$revision=$buildNumber.Substring($buildNumber.LastIndexOf('.') + 1)
$version='{0}.{1}.{2}.{3}' -f $(VersionPrefix) , $(BuildYear) , $(BuildDate), $(Revision)
Write-Host "##vso[task.setvariable variable=Revision;]$revision"
Write-Host "##vso[task.setvariable variable=VersionExt;]$version"
- task: UseDotNet@2
displayName: 'Use .NET Core sdk 3.0.100-preview7-012821'
inputs:
version: 3.0.100-preview7-012821
- task: DotNetCoreCLI@2
displayName: Restore
inputs:
command: restore
projects: '$(SolutionFile)'
- task: DotNetCoreCLI@2
displayName: Build
inputs:
projects: '$(SolutionFile)'
arguments: '--configuration $(BuildConfiguration) /p:Version=$(VersionExt)'
- task: DotNetCoreCLI@2
displayName: Test
inputs:
command: test
projects: '$(Parameters.TestProjects)'
arguments: '--configuration $(BuildConfiguration)'
- task: DotNetCoreCLI@2
displayName: Publish
inputs:
command: publish
publishWebProjects: True
arguments: '--configuration $(BuildConfiguration) --output $(build.artifactstagingdirectory) --no-build'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
artifactName: 'drop'
- stage: Deploy
jobs:
- job: GitHubPagesPush
pool:
name: Hosted Windows 2019 with VS2019
#name: Default
steps:
- task: DownloadBuildArtifacts@0
displayName: Download Build Artifacts to '$(System.ArtifactsDirectory)'
inputs:
artifactName: 'drop'
downloadPath: '$(System.ArtifactsDirectory)'
- task: ExtractFiles@1
displayName: 'Extract files'
inputs:
archiveFilePatterns: '$(System.ArtifactsDirectory)\*.zip'
destinationFolder: '$(build.artifactstagingdirectory)\disttmp'
- checkout: self
persistCredentials: 'true'
- powershell: |
$asmversion=[Reflection.AssemblyName]::GetAssemblyName("$(build.artifactstagingdirectory)\disttmp\one.dll").Version
Write-Host $asmversion
Write-Host "##vso[task.setvariable variable=VersionExt;]$asmversion"
- script: |
echo "VersionExt:"
echo %VERSIONEXT%
git checkout gh-pages
git rm . -r
xcopy $(build.artifactstagingdirectory)\disttmp\ . /s
git config user.email "[email protected]"
git config user.name "soerenOsisa"
git add .
git commit -m "auto-azure-deploy: %VERSIONEXT%"
git commit -m 'rebuild pages' --allow-empty
git push origin gh-pages
displayName: 'run git push gh-pages'
- powershell: |
$url="https://api.github.com/repos/soerenOsisa/test/gh-pages/builds"
$headers = @{}
$headers.Add("Authorization" , "Bearer bdb96ebc4ad2db3f78f31fd1207be669d42d0aed")
$headers.Add("Accept" , "application/vnd.github.mister-fantastic-preview+json" )
$method="POST"
$output = Invoke-RestMethod $url -Method $method -Headers $headers -ContentType "application/json" -Verbose
Write-Host $output
displayName: 'rebuild gh-pages'