fix(generator): declare task runtime and architecture #8
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
| # GitHub Actions workflow for building, testing, packing, and publishing the GoAffPro.Client library. | |
| # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
| name: Build, Test, and Publish GoAffPro.Client | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| release: | |
| types: | |
| - published | |
| env: | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
| DOTNET_NOLOGO: true | |
| NuGetDirectory: ${{ github.workspace }}/nuget | |
| defaults: | |
| run: | |
| shell: pwsh | |
| jobs: | |
| build_and_test: | |
| name: Build, Test, and Pack | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET SDKs | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: | | |
| 8.0.x | |
| 10.0.x | |
| - name: Restore dependencies | |
| run: dotnet restore GoAffPro.Client.slnx | |
| - name: Clean solution | |
| run: dotnet clean GoAffPro.Client.slnx --configuration Release | |
| - name: Build solution | |
| run: dotnet build GoAffPro.Client.slnx --configuration Release --no-restore | |
| - name: Run unit tests | |
| run: > | |
| dotnet test GoAffPro.Client.slnx | |
| --configuration Release | |
| --no-build | |
| --verbosity normal | |
| --filter "Category!=Integration" | |
| - name: Pack library (on main push or release) | |
| if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'release' | |
| run: > | |
| dotnet pack src/GoAffPro.Client/GoAffPro.Client.csproj | |
| --configuration Release | |
| --no-build | |
| --output ${{ env.NuGetDirectory }} | |
| - name: Upload NuGet package artifact (on main push or release) | |
| if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'release' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nuget-package | |
| if-no-files-found: error | |
| retention-days: 7 | |
| path: ${{ env.NuGetDirectory }}/*.nupkg | |
| publish_nuget: | |
| name: Publish NuGet Package | |
| needs: [ build_and_test ] | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Download NuGet package artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: nuget-package | |
| path: ${{ env.NuGetDirectory }} | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@v4 | |
| - name: Display package information | |
| run: Get-ChildItem "${{ env.NuGetDirectory }}" -Recurse -Include *.nupkg | ForEach-Object { $_.FullName } | |
| - name: NuGet login (OIDC -> temp API key) | |
| uses: NuGet/login@v1 | |
| id: login | |
| with: | |
| user: Agash | |
| - name: Publish NuGet package to NuGet.org | |
| run: | | |
| foreach($file in (Get-ChildItem "${{ env.NuGetDirectory }}" -Recurse -Include *.nupkg)) { | |
| Write-Host "Pushing package: $($file.FullName)" | |
| dotnet nuget push $file --api-key "${{ steps.login.outputs.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate | |
| } |