Migrate Azure Functions to net10, add Bruno test collection #884
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build CodeConverter | |
| on: | |
| push: | |
| branches: [ master, main ] | |
| pull_request: | |
| branches: [ master, main ] | |
| workflow_dispatch: | |
| inputs: | |
| publishNuget: | |
| description: "Publish NuGet package and dotnet tool" | |
| required: false | |
| type: boolean | |
| default: false | |
| deployWebFunc: | |
| description: "Deploy web/func artifacts" | |
| required: false | |
| type: boolean | |
| default: false | |
| createRelease: | |
| description: "Create GitHub release" | |
| required: false | |
| type: boolean | |
| default: false | |
| nugetApiKey: | |
| description: "NuGet API key (required if Publish NuGet is checked)" | |
| required: false | |
| type: string | |
| env: | |
| BuildVersion: '10.0.0' | |
| jobs: | |
| build: | |
| runs-on: windows-2022 | |
| env: | |
| BuildPlatform: Any CPU | |
| BuildTarget: Release | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Update project version | |
| uses: roryprimrose/set-vs-sdk-project-version@v1.0.6 | |
| with: | |
| projectFilter: 'Directory.Build.props' | |
| version: ${{ env.BuildVersion }}.${{ github.run_number }} | |
| assemblyVersion: ${{ env.BuildVersion }}.${{ github.run_number }} | |
| fileVersion: ${{ env.BuildVersion }}.${{ github.run_number }} | |
| - name: Setup .NET for main build | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Add msbuild to PATH | |
| uses: microsoft/setup-msbuild@v2 | |
| with: | |
| vs-version: '[17.0,)' | |
| - name: Dotnet deterministic Build | |
| run: dotnet build DotNetBuildable.slnf /p:Platform=$env:BuildPlatform /p:Configuration=$env:BuildTarget /p:ContinuousIntegrationBuild=true | |
| - name: Dotnet Publish | |
| run: dotnet publish DotNetPublishable.slnf /p:Platform=$env:BuildPlatform /p:Configuration=$env:BuildTarget | |
| - name: MSBuild Vsix | |
| run: msbuild Vsix\Vsix.csproj -restore /p:Configuration=$env:BuildTarget | |
| - name: Execute unit tests | |
| run: dotnet test $env:Tests1 | |
| env: | |
| Tests1: Tests/bin/${{ env.BuildTarget }}/ICSharpCode.CodeConverter.Tests.dll | |
| - name: Run vitest | |
| working-directory: Web | |
| run: npm test -- --run | |
| - name: Upload NuGet package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ICSharpCode.CodeConverter.${{ env.BuildVersion }}.nupkg | |
| path: CodeConverter/bin/${{ env.BuildTarget }}/ICSharpCode.CodeConverter.*.nupkg | |
| - name: Upload VSIX | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ICSharpCode.CodeConverter.VsExtension.${{ env.BuildVersion }}.vsix | |
| path: Vsix/bin/${{ env.BuildTarget }}/ICSharpCode.CodeConverter.VsExtension.vsix | |
| - name: Upload Tool | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ICSharpCode.CodeConverter.CodeConv.${{ env.BuildVersion }}.nupkg | |
| path: CodeConv/bin/${{ env.BuildTarget }}/ICSharpCode.CodeConverter.CodeConv.*.nupkg | |
| - name: Upload Web | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ICSharpCode.CodeConverter.Web.${{ env.BuildVersion }}.zip | |
| path: web/dist/ | |
| - name: Upload Function | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ICSharpCode.CodeConverter.Func.${{ env.BuildVersion }}.zip | |
| path: Func/bin/${{ env.BuildTarget }}/publish/ | |
| deploy: | |
| if: ${{ github.event_name == 'workflow_dispatch' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') }} | |
| concurrency: ci-${{ github.ref }} | |
| needs: [build] # The second job must depend on the first one to complete before running and uses ubuntu-latest instead of windows. | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout 🛎️ | |
| uses: actions/checkout@v4 | |
| - name: Download web artifact 🔻 # The built project is downloaded into the 'site' folder. | |
| if: ${{ inputs.deployWebFunc }} | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ICSharpCode.CodeConverter.Web.${{ env.BuildVersion }}.zip | |
| path: site | |
| - name: Download release artifacts | |
| if: ${{ inputs.createRelease || inputs.publishNuget }} | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: ICSharpCode.CodeConverter.* | |
| path: release-artifacts | |
| merge-multiple: true | |
| - name: Extract latest changelog section | |
| id: changelog | |
| shell: pwsh | |
| if: ${{ inputs.createRelease }} | |
| run: | | |
| ./Get-LatestChangelog.ps1 -Path CHANGELOG.md | Tee-Object -FilePath release-notes.md | |
| "notes<<EOF" >> $env:GITHUB_OUTPUT | |
| Get-Content release-notes.md >> $env:GITHUB_OUTPUT | |
| "EOF" >> $env:GITHUB_OUTPUT | |
| - name: Deploy 🚀 | |
| if: ${{ inputs.deployWebFunc }} | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| branch: 'autoupdated/gh-pages' | |
| folder: 'site/wwwroot' | |
| - name: Publish NuGet packages | |
| if: ${{ inputs.publishNuget }} | |
| shell: pwsh | |
| env: | |
| NUGET_API_KEY: ${{ inputs.nugetApiKey }} | |
| run: | | |
| if (-not $env:NUGET_API_KEY) { throw "nugetApiKey input is required when Publish NuGet is checked." } | |
| Write-Output "::add-mask::$env:NUGET_API_KEY" | |
| $source = "https://api.nuget.org/v3/index.json" | |
| $packages = @( | |
| "release-artifacts/ICSharpCode.CodeConverter.*.nupkg", | |
| "release-artifacts/ICSharpCode.CodeConverter.CodeConv.*.nupkg" | |
| ) | |
| foreach ($pattern in $packages) { | |
| Get-ChildItem -Path $pattern -File | ForEach-Object { | |
| dotnet nuget push $_.FullName -k $env:NUGET_API_KEY -s $source --skip-duplicate | |
| } | |
| } | |
| - name: Create GitHub release | |
| if: ${{ inputs.createRelease }} | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ env.BuildVersion }}.${{ github.run_number }} | |
| name: v${{ env.BuildVersion }}.${{ github.run_number }} | |
| body: ${{ steps.changelog.outputs.notes }} | |
| files: release-artifacts/** | |