1- name : Version, compile, test, pack and publish dev version
1+ name : Build
22
33on :
44 push :
5- branches-ignore :
6- - ' preview/**'
7- - ' release/**'
8- - ' support/**'
5+ branches :
6+ - ' **'
97 paths-ignore :
108 - ' !src/**'
119
@@ -19,59 +17,61 @@ concurrency:
1917 cancel-in-progress : false
2018
2119env :
22- is-release : ${{ startsWith(github.ref_name, 'release') || startsWith(github.ref_name, 'preview') }}
20+ is-release : ${{ startsWith(github.ref_name, 'release') }}
21+ is-preview : ${{ startsWith(github.ref_name, 'preview') }}
2322 dotnet-sdk-version : ' 9.x'
2423 build-configuration : ' Release'
2524 build-platform : ' Any CPU'
2625 git-version : ' 6.0.x'
2726 test-result-directory : ' test-results'
27+ nuget-packages-directory : ' nuget-packages'
2828
29- jobs :
30- versioning :
31- name : Versioning with GitVersion
29+ jobs :
30+ variables :
31+ name : ' GitHub variables '
3232 runs-on : ubuntu-latest
33+
3334 outputs :
34- ASSEMBLY_VERSION : ${{ steps.gitversion.outputs.assemblySemVer }}.${{ github.run_number }}
35- ASSEMBLY_INFORMATIONAL_VERSION : ${{ steps.gitversion.outputs.assemblySemVer }}.${{ github.run_number }}+${{ steps.gitversion.outputs.sha }}
36- FILE_VERSION : ${{ steps.gitversion.outputs.assemblySemVer }}.${{ github.run_number }}
37- PACKAGE_VERSION : ${{ fromJSON(format('[ "{0}{1}", "{0}" ]', steps.gitversion.outputs.assemblySemVer, steps.gitversion.outputs.preReleaseLabelWithDash))[fromJSON(env.is-release)] }}
35+ github-run-id : ${{ github.run_id }}
36+ github-run-number : ${{ github.run_number }}
3837
3938 steps :
40- - name : ' Checkout ${{ github.head_ref || github.ref }}'
41- uses : actions/checkout@v4
42- with :
43- fetch-depth : 0
44- - name : Install GitVersion ${{ env.git-version }}
45- uses : gittools/actions/gitversion/setup@v3.1.11
46- with :
47- versionSpec : ${{ env.git-version }}
48- preferLatestVersion : true
49- - name : Determine version with GitVersion ${{ env.git-version }}
50- id : gitversion
51- uses : gittools/actions/gitversion/execute@v3.1.11
52- with :
53- useConfigFile : true
54- configFilePath : ./.gitversion/version.yml
39+ - name : ' GitHub variables'
40+ id : github
41+ run : |
42+ echo "github.run_id=${{ github.run_id }}"
43+ echo "github.run_number=${{ github.run_number }}"
44+
45+ versioning :
46+ name : Versioning with GitVersion
47+ needs : [variables]
48+
49+ uses : ./.github/workflows/determine-version.yml
50+ with :
51+ config-file-path : ' ./.gitversion/version.yml'
52+ run-number : ${{ needs.variables.outputs.github-run-number }}
5553
5654 build :
5755 name : Build with .NET
5856 needs : [versioning]
5957 runs-on : ubuntu-latest
58+
6059 env :
61- ASSEMBLY_VERSION : ${{ needs.versioning.outputs.ASSEMBLY_VERSION }}
62- ASSEMBLY_INFORMATIONAL_VERSION : ${{ needs.versioning.outputs.ASSEMBLY_INFORMATIONAL_VERSION }}
63- FILE_VERSION : ${{ needs.versioning.outputs.FILE_VERSION }}
60+ assembly-version : ${{ needs.versioning.outputs.assembly-version }}
61+ assembly-informational-version : ${{ needs.versioning.outputs.assembly-informational-version }}
62+ file-version : ${{ needs.versioning.outputs.file-version }}
63+
6464 steps :
6565 - name : ' Checkout ${{ github.head_ref || github.ref }}'
6666 uses : actions/checkout@v4
6767
6868 - uses : ./.github/actions/build
6969 with :
70- assembly-version : ${{ env.ASSEMBLY_VERSION }}
71- assembly-informational-version : ${{ env.ASSEMBLY_INFORMATIONAL_VERSION }}
72- assembly- file-version : ${{ env.FILE_VERSION }}
70+ assembly-version : ${{ env.assembly-version }}
71+ assembly-informational-version : ${{ env.assembly-informational-version }}
72+ file-version : ${{ env.file-version }}
7373 treat-warnins-as-error : ${{ env.is-release }}
74- build -glob-pattern : ${{ vars.SRC_DEFAULT_GLOB_PATTERN }}
74+ search -glob-pattern : ${{ vars.SRC_DEFAULT_GLOB_PATTERN }}
7575
7676 test :
7777 name : Test with .NET
@@ -89,78 +89,208 @@ jobs:
8989 - uses : ./.github/actions/test
9090 with :
9191 test-project-glob-pattern : ${{ vars.TEST_DEFAULT_GLOB_PATTERN }}
92- test-results-directory : ' ${{ runner.temp }}/test-results /'
92+ test-results-directory : ' ${{ runner.temp }}/${{ env. test-result-directory }} /'
9393 code-coverage-settings-file : ' ${{ github.workspace}}/code-coverage-settings.xml'
9494
9595 - uses : ./.github/actions/test-report
9696 id : test-report
9797 with :
98- test-result-folder : ' ${{ runner.temp }}/test-results /'
98+ test-result-folder : ' ${{ runner.temp }}/${{ env. test-result-directory }} /'
9999
100100 - name : Write test report summary
101- uses : ./.github/action/write-file-to-summary
102- with :
103- file-path : ${{ steps.test-report.outputs.test-report-file }}
101+ run : cat ${{ steps.test-report.outputs.test-report-file }} >> $GITHUB_STEP_SUMMARY
104102
105103 - uses : ./.github/actions/code-coverage
106104 id : code-coverage-report
107105 with :
108- test-result-folder : ' ${{ runner.temp }}/test-results /'
106+ test-result-folder : ' ${{ runner.temp }}/${{ env. test-result-directory }} /'
109107
110108 - name : Write code coverage report summary
111- uses : ./.github/action/write-file-to-summary
112- with :
113- file-path : ${{ steps.code-coverage-report.outputs.code-coverage-report-file }}
109+ run : cat ${{ steps.code-coverage-report.outputs.code-coverage-report-file }} >> $GITHUB_STEP_SUMMARY
114110
115111 pack :
116112 name : Pack with .NET
117- needs : [build, versioning ]
113+ needs : [versioning, build ]
118114 runs-on : ubuntu-latest
119115 env :
120- ASSEMBLY_VERSION : ${{ needs.versioning.outputs.ASSEMBLY_VERSION }}
121- ASSEMBLY_INFORMATIONAL_VERSION : ${{ needs.versioning.outputs.ASSEMBLY_INFORMATIONAL_VERSION }}
122- FILE_VERSION : ${{ needs.versioning.outputs.FILE_VERSION }}
123- PACKAGE_VERSION : ${{ needs.versioning.outputs.PACKAGE_VERSION }}
116+ assembly-version : ${{ needs.versioning.outputs.assembly-version }}
117+ assembly-informational-version : ${{ needs.versioning.outputs.assembly-informational-version }}
118+ file-version : ${{ needs.versioning.outputs.file-version }}
119+ package-version : ${{ needs.versioning.outputs.package-version }}
120+ package-artifact-name : package
121+ outputs :
122+ package-artifact-name : ${{ env.package-artifact-name }}
124123 steps :
125124 - name : ' Checkout ${{ github.head_ref || github.ref }}'
126125 uses : actions/checkout@v4
126+
127127 - name : Setup .NET
128128 uses : actions/setup-dotnet@v4
129129 with :
130130 dotnet-version : ${{ env.dotnet-sdk-version }}
131+
131132 - name : Download Build
132133 uses : actions/download-artifact@v4
133134 with :
134135 name : build
136+
135137 - name : Pack with .NET
136138 run : |
137- dotnet pack ${{ vars.SRC_DEFAULT_GLOB_PATTERN }} --configuration ${{ env.build-configuration }} /p:Platform="${{ env.build-platform }}" /p:PackageVersion=${{ env.PACKAGE_VERSION }} /p:Version=${{ env.ASSEMBLY_VERSION }} /p:AssemblyInformationalVersion=${{ env.ASSEMBLY_INFORMATIONAL_VERSION }} /p:FileVersion=${{ env.FILE_VERSION }} --output ${{ runner.temp }}/packages/
139+ dotnet pack ${{ vars.SRC_DEFAULT_GLOB_PATTERN }} --configuration ${{ env.build-configuration }} /p:Platform="${{ env.build-platform }}" /p:PackageVersion=${{ env.package-version }} /p:Version=${{ env.assembly-version }} /p:AssemblyInformationalVersion=${{ env.assembly-informational-version }} /p:FileVersion=${{ env.file-version }} --output ${{ runner.temp }}/${{ env.nuget-packages-directory }}
140+
138141 - name : Upload Package
139142 uses : actions/upload-artifact@v4
140143 with :
141- name : package
144+ name : ${{ env. package-artifact-name }}
142145 path : |
143- ${{ runner.temp }}/packages/**/*.nupkg
144- ${{ runner.temp }}/packages/**/*.snupkg
146+ ${{ runner.temp }}/${{ env.nuget- packages-directory }} /**/*.nupkg
147+ ${{ runner.temp }}/${{ env.nuget- packages-directory }} /**/*.snupkg
145148
146- publish-internal-package :
147- if : ${{ !github.env.is_release }}
148- name : Publish package with .NET CLI
149- needs : [pack]
150- runs-on : ubuntu-latest
151- steps :
152- - name : ' Checkout ${{ github.head_ref || github.ref }}'
153- uses : actions/checkout@v4
154- - name : Dotnet Setup
155- uses : actions/setup-dotnet@v4
156- with :
157- dotnet-version : ${{ env.dotnet-sdk-version }}
158- - name : Download Packages
159- uses : actions/download-artifact@v4
160- with :
161- name : package
162- path : ${{ runner.temp }}/packages/
163- - run : |
164- dotnet nuget add source ${{ secrets.PRIVATE_NUGET_PACKAGE_FEED_URL }} --name private-feed --username username --password ${{ secrets.PRIVATE_NUGET_PACKAGE_FEED_API_KEY }} --store-password-in-clear-text
165- dotnet nuget push **/*.nupkg --source private-feed --api-key ${{ secrets.PRIVATE_NUGET_PACKAGE_FEED_API_KEY }}
166- working-directory: ${{ runner.temp }}/packages/
149+ publish-dev-package :
150+ name : ' Publish'
151+ uses : ./.github/workflows/release-nuget-package.yml
152+ needs : [pack,variables]
153+
154+ secrets : inherit
155+
156+ with :
157+ artifact-run-id : ${{ needs.variables.outputs.github-run-id }}
158+ artifact-name : ${{ needs.pack.outputs.package-artifact-name }}
159+ nuget-feed-server : ' AzureArtifacts'
160+ environment : ' Development'
161+
162+ publish-production-package :
163+ if : ${{ env.is-release || env.is-preview }}
164+ name : ' Publish'
165+ uses : ./.github/workflows/release-nuget-package.yml
166+ needs : [pack,variables]
167+
168+ secrets : inherit
169+
170+ with :
171+ artifact-run-id : ${{ needs.variables.outputs.github-run-id }}
172+ artifact-name : ${{ needs.pack.outputs.package-artifact-name }}
173+ nuget-feed-server : ' NuGet'
174+ environment : ' NuGet'
175+
176+ # benchmark:
177+ # if: ${{ github.env.is_release || vars.BENCHMARKDOTNET_RUN_OVERRIDE == 'true' }}
178+ # name: Benchmark with .NET CLI on ${{ matrix.os }}
179+ # needs: [build]
180+ # strategy:
181+ # matrix:
182+ # os: [ubuntu-latest, windows-latest, macos-latest]
183+ # runs-on: ${{ matrix.os }}
184+ # steps:
185+ # - name: 'Checkout ${{ github.head_ref || github.ref }}'
186+ # uses: actions/checkout@v4
187+ # - name: Install .NET SDK
188+ # uses: actions/setup-dotnet@v4
189+ # with:
190+ # dotnet-version: |
191+ # 6.x
192+ # 8.x
193+ # 9.x
194+ # - name: Download Build
195+ # uses: actions/download-artifact@v4
196+ # with:
197+ # name: build
198+ # - name: Benchmark
199+ # working-directory: ${{ vars.BENCHMARKDOTNET_WORKING_DIRECTORY }}
200+ # run: dotnet run --configuration ${{ env.build-configuration }} /p:Platform=${{ env.build-platform }} --framework ${{ vars.DEFAULT_BUILD_FRAMEWORK }} --runtimes ${{ vars.BENCHMARKDOTNET_RUNTIMES }} --filter ${{ vars.BENCHMARKDOTNET_FILTER }} --exporters GitHub --memory --artifacts ${{ runner.temp }}/benchmarks/ --join
201+ # - name: Upload Benchmark Results
202+ # uses: actions/upload-artifact@v4
203+ # with:
204+ # name: benchmark-${{ matrix.os }}
205+ # path: |
206+ # ${{ runner.temp }}/benchmarks/**/*-report-github.md
207+ # - name: Write Benchmark Summary
208+ # shell: bash
209+ # run: cat **/*-report-github.md > $GITHUB_STEP_SUMMARY
210+ # working-directory: ${{ runner.temp }}/benchmarks/
211+
212+ # publish-docs:
213+ # if: ${{ github.env.is_release && !github.env.is_preview }}
214+ # name: Docs with docfx
215+ # needs: [benchmark, test]
216+ # environment:
217+ # name: github-pages
218+ # url: ${{ steps.deployment.outputs.page_url }}
219+ # runs-on: ubuntu-latest
220+ # steps:
221+ # - name: 'Checkout ${{ github.head_ref || github.ref }}'
222+ # uses: actions/checkout@v4
223+ # - name: Dotnet Setup
224+ # uses: actions/setup-dotnet@v4
225+ # with:
226+ # dotnet-version: ${{ env.dotnet-sdk-version }}
227+ # - name: Download Benchmarks
228+ # uses: actions/download-artifact@v4
229+ # with:
230+ # pattern: benchmark-*
231+ # path: ${{ runner.temp }}/benchmarks/
232+ # merge-multiple: false
233+ # - run: |
234+ # echo -e '\n## Windows' >> ${{ github.workspace}}/docfx/benchmarks/index.md
235+ # cat benchmark-windows-latest/**/*.md >> ${{ github.workspace}}/docfx/benchmarks/index.md
236+ # echo -e '\n## Linux' >> ${{ github.workspace}}/docfx/benchmarks/index.md
237+ # cat benchmark-ubuntu-latest/**/*.md >> ${{ github.workspace}}/docfx/benchmarks/index.md
238+ # echo -e '\n## macOS' >> ${{ github.workspace}}/docfx/benchmarks/index.md
239+ # cat benchmark-macos-latest/**/*.md >> ${{ github.workspace}}/docfx/benchmarks/index.md
240+ # working-directory: ${{ runner.temp }}/benchmarks/
241+ # - run: dotnet tool update -g docfx
242+ # - run: docfx ./docfx/docfx.json
243+ # - name: Upload artifact
244+ # uses: actions/upload-pages-artifact@v4
245+ # with:
246+ # path: './docs'
247+ # - name: Deploy to GitHub Pages
248+ # id: deployment
249+ # uses: actions/deploy-pages@v4
250+
251+ # publish-package-internal:
252+ # if: ${{ !github.env.is_release }}
253+ # name: Publish package with .NET CLI
254+ # needs: [pack]
255+ # environment:
256+ # name: private-nuget-feed
257+ # runs-on: ubuntu-latest
258+ # steps:
259+ # - name: 'Checkout ${{ github.head_ref || github.ref }}'
260+ # uses: actions/checkout@v4
261+ # - name: Dotnet Setup
262+ # uses: actions/setup-dotnet@v4
263+ # with:
264+ # dotnet-version: ${{ env.dotnet-sdk-version }}
265+ # - name: Download Packages
266+ # uses: actions/download-artifact@v4
267+ # with:
268+ # name: package
269+ # path: ${{ runner.temp }}/packages/
270+ # - run: |
271+ # dotnet nuget add source ${{ secrets.PRIVATE_NUGET_PACKAGE_FEED_URL }} --name private-feed --username username --password ${{ secrets.PRIVATE_NUGET_PACKAGE_FEED_API_KEY }} --store-password-in-clear-text
272+ # dotnet nuget push **/*.nupkg --source private-feed --api-key ${{ secrets.PRIVATE_NUGET_PACKAGE_FEED_API_KEY }}
273+ # working-directory: ${{ runner.temp }}/packages/
274+
275+ # release-package:
276+ # if: ${{ github.env.is_release }}
277+ # name: Release package with .NET CLI
278+ # needs: [pack, test]
279+ # environment:
280+ # name: public-nuget-feed
281+ # runs-on: ubuntu-latest
282+ # steps:
283+ # - name: 'Checkout ${{ github.head_ref || github.ref }}'
284+ # uses: actions/checkout@v4
285+ # - name: Dotnet Setup
286+ # uses: actions/setup-dotnet@v4
287+ # with:
288+ # dotnet-version: ${{ env.dotnet-sdk-version }}
289+ # - name: Download Packages
290+ # uses: actions/download-artifact@v4
291+ # with:
292+ # name: package
293+ # path: ${{ runner.temp }}/packages/
294+ # - run: |
295+ # dotnet nuget push **/*.nupkg --source ${{ vars.PUBLIC_NUGET_PACKAGE_FEED_URL }} --api-key ${{ secrets.PUBLIC_NUGET_PACKAGE_FEED_API_KEY }}
296+ # working-directory: ${{ runner.temp }}/packages/
0 commit comments