Skip to content

Commit 1f306f7

Browse files
committed
Set up CI with Azure Pipelines
additional pipeline for custom releases [skip ci]
1 parent adca947 commit 1f306f7

File tree

1 file changed

+136
-0
lines changed

1 file changed

+136
-0
lines changed

azure-pipelines-dev.yml

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# https://aka.ms/yaml
2+
3+
trigger:
4+
branches:
5+
include:
6+
- dev/*
7+
paths:
8+
exclude:
9+
- docs/*
10+
- README.md
11+
- azure-pipelines.yml
12+
13+
variables:
14+
- group: GitRelease
15+
16+
- name: patch
17+
value: $[counter('versioncounter', 1)]
18+
- name: buildPlatform
19+
value: 'Any CPU'
20+
- name: buildConfiguration
21+
value: 'Release'
22+
- name: GitHubApplicationName
23+
value: 'Amusoft.VisualStudio.TemplateGenerator'
24+
- name: GitHubRepoName
25+
value: 'Amusoft.VisualStudio.TemplateGenerator'
26+
- name: GitHubAssetsPattern
27+
value: '$(Build.ArtifactStagingDirectory)\*.zip'
28+
- name: GitHubAccessToken
29+
value: '$(gitAccessToken)'
30+
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
31+
value: 1
32+
33+
pool:
34+
vmImage: 'windows-2019'
35+
36+
jobs:
37+
38+
- job:
39+
displayName: Build
40+
condition: succeeded()
41+
steps:
42+
43+
- task: PowerShell@2
44+
displayName: GetVersion .Desktop
45+
inputs:
46+
filePath: 'build\csproj-version-to-pipeline.ps1'
47+
arguments: '$(patch) $(Build.SourcesDirectory)\src\Generator.Client.Desktop\Generator.Client.Desktop.csproj PackageVersion'
48+
49+
- task: PowerShell@2
50+
displayName: GetVersion .CLI
51+
inputs:
52+
filePath: 'build\csproj-version-to-pipeline.ps1'
53+
arguments: '$(patch) $(Build.SourcesDirectory)\src\Generator.Client.CommandLine\Generator.Client.CommandLine.csproj PackageVersionCLI'
54+
55+
- task: NuGetToolInstaller@1
56+
inputs:
57+
versionSpec: '4.x'
58+
59+
- task: NuGetCommand@2
60+
inputs:
61+
command: 'restore'
62+
restoreSolution: '**/*.sln'
63+
feedsToUse: 'select'
64+
65+
- task: VSBuild@1
66+
inputs:
67+
solution: '**\*.sln'
68+
platform: '$(buildPlatform)'
69+
configuration: '$(buildConfiguration)'
70+
71+
- task: VSTest@2
72+
condition: succeeded()
73+
inputs:
74+
testSelector: 'testAssemblies'
75+
testAssemblyVer2: |
76+
**\*test*.dll
77+
!**\*TestAdapter.dll
78+
!**\obj\**
79+
searchFolder: '$(System.DefaultWorkingDirectory)'
80+
81+
- task: PowerShell@2
82+
condition: and(succeeded())
83+
displayName: dotnet publish
84+
inputs:
85+
targetType: 'inline'
86+
script: |
87+
mkdir $(Build.ArtifactStagingDirectory)\desktop
88+
& dotnet build $(Build.SourcesDirectory)\src\Generator.Client.Desktop\Generator.Client.Desktop.csproj -r win-x64 -c $(buildConfiguration)
89+
& dotnet publish $(Build.SourcesDirectory)\src\Generator.Client.Desktop\Generator.Client.Desktop.csproj -r win-x64 -c $(buildConfiguration) --self-contained --no-build -o $(Build.ArtifactStagingDirectory)\desktop
90+
91+
mkdir $(Build.ArtifactStagingDirectory)\cli-netcore2.1-standalone
92+
mkdir $(Build.ArtifactStagingDirectory)\cli-netcore2.1-shared
93+
& dotnet publish $(Build.SourcesDirectory)\src\Generator.Client.CommandLine\Generator.Client.CommandLine.csproj -r win-x64 -f netcoreapp2.1 -c $(buildConfiguration) --self-contained true -o $(Build.ArtifactStagingDirectory)\cli-netcore2.1-standalone
94+
& dotnet publish $(Build.SourcesDirectory)\src\Generator.Client.CommandLine\Generator.Client.CommandLine.csproj -r win-x64 -f netcoreapp2.1 -c $(buildConfiguration) --self-contained false -o $(Build.ArtifactStagingDirectory)\cli-netcore2.1-shared
95+
96+
- task: PowerShell@2
97+
condition: and(succeeded())
98+
displayName: dotnet pack dev
99+
inputs:
100+
targetType: 'inline'
101+
script: |
102+
dotnet --version
103+
mkdir $(Build.ArtifactStagingDirectory)\nupkg
104+
Write-Host $(PackageVersion)
105+
Write-Host $(PackageVersionCLI)
106+
$commandSample = "dotnet pack $(Build.SourcesDirectory)\src\Generator.Client.CommandLine\Generator.Client.CommandLine.csproj -c $(buildConfiguration) -o $(Build.ArtifactStagingDirectory)\nupkg /p:PackAsTool=true /p:VersionPrefix=$(PackageVersionCLI) /p:SymbolPackageFormat=snupkg --include-symbols --version-suffix=alpha"
107+
Write-Host $commandSample
108+
Invoke-Expression $commandSample
109+
110+
- task: CopyFiles@2
111+
condition: and(succeeded())
112+
inputs:
113+
SourceFolder: '$(Build.SourcesDirectory)'
114+
Contents: |
115+
**/*.md
116+
TargetFolder: '$(Build.ArtifactStagingDirectory)'
117+
118+
- task: PowerShell@2
119+
condition: and(succeeded())
120+
displayName: zip artifacts
121+
inputs:
122+
targetType: 'inline'
123+
script: |
124+
7z a $(Build.ArtifactStagingDirectory)\TemplateGenerator_$(PackageVersion)_win64.zip $(Build.ArtifactStagingDirectory)\*
125+
126+
- task: PublishPipelineArtifact@0
127+
condition: and(succeeded())
128+
inputs:
129+
artifactName: 'drop'
130+
targetPath: '$(Build.ArtifactStagingDirectory)\TemplateGenerator_$(PackageVersion)_win64.zip'
131+
132+
- task: PublishPipelineArtifact@0
133+
condition: and(succeeded())
134+
inputs:
135+
artifactName: 'nupkg'
136+
targetPath: '$(Build.ArtifactStagingDirectory)\nupkg'

0 commit comments

Comments
 (0)