-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
azure-pipelines.yml
114 lines (99 loc) · 4.94 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
trigger:
branches:
include:
- blazor-*
tags:
include:
- v*
pool:
vmImage: 'ubuntu-latest'
variables:
- group: secrets
- group: defaults
steps:
- task: UseDotNet@2
displayName: Install dotnet 8 SDK
inputs:
version: '8.x'
packageType: sdk
- script: |
dotnet build ./src/Piral.Blazor.Core --configuration $(buildConfiguration) --version-suffix pre.$BUILD_BUILDNUMBER
dotnet build ./src/Piral.Blazor.Utils --configuration $(buildConfiguration) --version-suffix pre.$BUILD_BUILDNUMBER
dotnet build ./src/Piral.Blazor.Analyzer --configuration $(buildConfiguration) --version-suffix pre.$BUILD_BUILDNUMBER
dotnet build ./src/Piral.Blazor.Tools --configuration $(buildConfiguration) --version-suffix pre.$BUILD_BUILDNUMBER
dotnet build ./src/Piral.Blazor.DevServer --configuration $(buildConfiguration) --version-suffix pre.$BUILD_BUILDNUMBER
displayName: 'Build Assemblies (Pre)'
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/heads/blazor-'))
- script: |
dotnet build ./src/Piral.Blazor.Core --configuration $(buildConfiguration)
dotnet build ./src/Piral.Blazor.Utils --configuration $(buildConfiguration)
dotnet build ./src/Piral.Blazor.Analyzer --configuration $(buildConfiguration)
dotnet build ./src/Piral.Blazor.Tools --configuration $(buildConfiguration)
dotnet build ./src/Piral.Blazor.DevServer --configuration $(buildConfiguration)
displayName: 'Build Assemblies'
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
- script: |
rm ~/.nuget/packages/microsoft.aspnetcore.components/8.0.5/lib/net8.0/Microsoft.AspNetCore.Components.dll
cp tools/Microsoft.AspNetCore.Components.dll ~/.nuget/packages/microsoft.aspnetcore.components/8.0.5/lib/net8.0/Microsoft.AspNetCore.Components.dll
displayName: 'Change GAC'
- script: |
dotnet build tests
dotnet test tests
displayName: 'Run Tests'
- script: |
cd ./src/Piral.Blazor.Core
export TARGET_VERSION=`node -e 'console.log(require("./obj/project.assets.json").project.version)'`
export NPM_TOKEN=$(npmToken)
dotnet build -c Release
dotnet publish -c Release --output ../../dist/release
dotnet build -c Debug
dotnet publish -c Debug --output ../../dist/debug -p:CopyOutputSymbolsToPublishDirectory=true
cd ../../dist
cp ../template/* .
cp ../LICENSE .
npm version $TARGET_VERSION
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
echo always-auth=true >> ~/.npmrc
cd ..
displayName: 'Prepare NPM Package'
- script: |
cd dist
sed -i -e "s/\(\"version\":\\s\+\"\([0-9]\+\.\?\)\+\)/\1-pre.$BUILD_BUILDNUMBER/" ./package.json;
cat ~/.npmrc
npm publish --tag next
cd ..
displayName: 'Publish Pre-Package on NPM'
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/heads/blazor-'))
- script: |
cd dist
npm publish --tag latest
cd ..
displayName: 'Publish Package on NPM'
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
- script: rm -rf dist
displayName: 'Reset Output'
- script: |
dotnet pack ./src/Piral.Blazor.Core --configuration $(buildConfiguration) --version-suffix pre.$BUILD_BUILDNUMBER --output ./dist
dotnet pack ./src/Piral.Blazor.Utils --configuration $(buildConfiguration) --version-suffix pre.$BUILD_BUILDNUMBER --output ./dist
dotnet pack ./src/Piral.Blazor.Template --configuration $(buildConfiguration) --version-suffix pre.$BUILD_BUILDNUMBER --output ./dist
dotnet pack ./src/Piral.Blazor.Analyzer --configuration $(buildConfiguration) --version-suffix pre.$BUILD_BUILDNUMBER --output ./dist
dotnet pack ./src/Piral.Blazor.Tools --configuration $(buildConfiguration) --version-suffix pre.$BUILD_BUILDNUMBER --output ./dist
dotnet pack ./src/Piral.Blazor.DevServer --configuration $(buildConfiguration) --version-suffix pre.$BUILD_BUILDNUMBER --output ./dist
displayName: 'Pack Assemblies (Pre)'
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/heads/blazor-'))
- script: |
dotnet pack ./src/Piral.Blazor.Core --configuration $(buildConfiguration) --output ./dist
dotnet pack ./src/Piral.Blazor.Utils --configuration $(buildConfiguration) --output ./dist
dotnet pack ./src/Piral.Blazor.Template --configuration $(buildConfiguration) --output ./dist
dotnet pack ./src/Piral.Blazor.Analyzer --configuration $(buildConfiguration) --output ./dist
dotnet pack ./src/Piral.Blazor.Tools --configuration $(buildConfiguration) --output ./dist
dotnet pack ./src/Piral.Blazor.DevServer --configuration $(buildConfiguration) --output ./dist
displayName: 'Pack Assemblies'
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
- task: NuGetCommand@2
displayName: 'Publish Packages on NuGet'
inputs:
command: 'push'
packagesToPush: 'dist/*.nupkg'
publishFeedCredentials: 'nuget'
nuGetFeedType: 'external'