Egil.Orleans.Messaging #246
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
| # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
| name: egil-systemtextjson-migration | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - 'main' | |
| - 'release/egil-systemtextjson-migration/v*' | |
| pull_request: | |
| branches: | |
| - 'main' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
| DOTNET_NOLOGO: true | |
| NuGetDirectory: ${{ github.workspace}}/nuget | |
| TestResultsDirectory: ${{ github.workspace}}/TestResults | |
| BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | |
| Project: Egil.SystemTextJson.Migration | |
| permissions: | |
| contents: read | |
| # SDK band policy: every setup-dotnet step below installs only the 10.x SDK | |
| # because the package and all of its projects (src, test, perf, samples) target | |
| # net10.0 exclusively. Keep these bands in sync with the retained target | |
| # frameworks: add a band here only when a matching TFM is reintroduced, and drop | |
| # one when its TFM is removed. | |
| jobs: | |
| create-nuget: | |
| runs-on: ubuntu-latest | |
| if: github.event.inputs.prepare-release != 'true' | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 10.x | |
| - run: | | |
| dotnet build ./Egil.SystemTextJson.Migration/src/Egil.SystemTextJson.Migration/Egil.SystemTextJson.Migration.csproj -c Release -f net10.0 | |
| dotnet pack ./Egil.SystemTextJson.Migration/src/Egil.SystemTextJson.Migration/Egil.SystemTextJson.Migration.csproj -c Release --no-build --output ${{ env.NuGetDirectory }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: nuget | |
| if-no-files-found: error | |
| retention-days: 7 | |
| path: ${{ env.NuGetDirectory }}/*.nupkg | |
| validate-nuget: | |
| runs-on: ubuntu-latest | |
| if: github.event.inputs.prepare-release != 'true' | |
| needs: [ create-nuget ] | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 10.x | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: nuget | |
| path: ${{ env.NuGetDirectory }} | |
| - name: Install nuget validator | |
| run: dotnet tool restore | |
| - name: Validate package | |
| shell: pwsh | |
| run: dotnet meziantou.validate-nuget-package (Get-ChildItem "${{ env.NuGetDirectory }}/*.nupkg") --excluded-rules IconMustBeSet | |
| run-test: | |
| runs-on: ubuntu-latest | |
| if: github.event.inputs.prepare-release != 'true' | |
| timeout-minutes: 30 | |
| env: | |
| TestResultsDirectory: ${{ github.workspace }}/TestResults | |
| permissions: | |
| contents: read | |
| checks: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 10.x | |
| - name: Run tests | |
| run: | | |
| export GITHUB_ENV=/dev/null | |
| dotnet test ./Egil.SystemTextJson.Migration/Egil.SystemTextJson.Migration.slnx --configuration Release | |
| - name: Verify documentation snippets | |
| working-directory: Egil.SystemTextJson.Migration | |
| run: | | |
| dotnet tool restore | |
| dotnet mdsnippets --convention InPlaceOverwrite --write-header false | |
| git diff --exit-code -- '*.md' | |
| release: | |
| needs: [validate-nuget, run-test] | |
| if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/heads/release/egil-systemtextjson-migration/v') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: nuget | |
| path: ${{ env.NuGetDirectory }} | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 10.x | |
| - name: NuGet login (trusted publishing) | |
| uses: NuGet/login@v1 | |
| id: login | |
| with: | |
| user: ${{ secrets.NUGET_USER }} | |
| - name: Publish NuGet package | |
| shell: pwsh | |
| run: | | |
| foreach($file in (Get-ChildItem "${{ env.NuGetDirectory }}" -Recurse -Include *.nupkg)) { | |
| dotnet nuget push $file --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate | |
| } | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Configure GIT | |
| run: | | |
| git config user.name "${{ github.actor }}" | |
| git config user.email "${{ github.actor }}@users.noreply.github.com" | |
| - name: Add git tag using dotnet nbgv | |
| run: | | |
| cd ${{ env.Project }} | |
| dotnet tool restore | |
| dotnet nbgv tag | |
| git push origin --tags | |
| - name: Delete release branch on origin | |
| if: startsWith(github.ref, 'refs/heads/release/egil-systemtextjson-migration/v') | |
| run: git push origin --delete "${{ env.BRANCH_NAME }}" |