Publish to feedz.io #178
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: ci | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths-ignore: | |
| - '**.md' | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| env: | |
| DOTNET_CLI_TELEMETRY_OPTOUT: true | |
| DOTNET_NOLOGO: true | |
| DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: 1 | |
| NUGET_XMLDOC_MODE: skip | |
| TERM: xterm | |
| permissions: {} | |
| jobs: | |
| build-test: | |
| name: ${{ matrix.os-name }} | |
| runs-on: ${{ matrix.runner }} | |
| outputs: | |
| dotnet-sdk-version: ${{ steps.setup-dotnet.outputs.dotnet-version }} | |
| permissions: | |
| attestations: write | |
| contents: write | |
| id-token: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os-name: macos | |
| runner: macos-latest | |
| - os-name: linux | |
| runner: ubuntu-latest | |
| - os-name: windows | |
| runner: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 0 | |
| filter: 'tree:0' | |
| show-progress: false | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1 | |
| id: setup-dotnet | |
| - name: Build | |
| run: dotnet build --configuration Release | |
| - name: Test | |
| run: dotnet test --configuration Release --logger:"GitHubActions;report-warnings=false" | |
| - name: Generate SBOM | |
| uses: anchore/sbom-action@7b36ad622f042cab6f59a75c2ac24ccb256e9b45 # v0.20.4 | |
| if: runner.os == 'Windows' | |
| with: | |
| artifact-name: grafana-opentelemetry-dotnet.spdx.json | |
| output-file: ./artifacts/grafana-opentelemetry-dotnet.spdx.json | |
| path: ./artifacts/bin | |
| upload-release-assets: true | |
| - name: Attest artifacts | |
| uses: actions/attest-build-provenance@e8998f949152b193b063cb0ec769d69d929409be # v2.4.0 | |
| if: | | |
| runner.os == 'Windows' && | |
| github.event.repository.fork == false && | |
| (github.ref_name == github.event.repository.default_branch || startsWith(github.ref, 'refs/tags/')) | |
| with: | |
| subject-path: | | |
| ./artifacts/bin/Grafana.OpenTelemetry*/release*/Grafana.OpenTelemetry*.dll | |
| ./artifacts/package/release/* | |
| - name: Publish NuGet packages | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| with: | |
| name: packages-${{ matrix.os-name }} | |
| path: ./artifacts/package/release | |
| if-no-files-found: error | |
| validate-packages: | |
| needs: build-test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download packages | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| name: packages-windows | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1 | |
| with: | |
| dotnet-version: ${{ needs.build-test.outputs.dotnet-sdk-version }} | |
| - name: Validate NuGet packages | |
| shell: pwsh | |
| run: | | |
| dotnet tool install --global dotnet-validate --version 0.0.1-preview.304 --allow-roll-forward | |
| $packages = Get-ChildItem -Filter "*.nupkg" | ForEach-Object { $_.FullName } | |
| $invalidPackages = 0 | |
| foreach ($package in $packages) { | |
| dotnet validate package local $package | |
| if ($LASTEXITCODE -ne 0) { | |
| $invalidPackages++ | |
| } | |
| } | |
| if ($invalidPackages -gt 0) { | |
| Write-Output "::error::$invalidPackages NuGet package(s) failed validation." | |
| exit 1 | |
| } | |
| publish-feedz-io: | |
| needs: [ build-test, validate-packages ] | |
| runs-on: ubuntu-latest | |
| if: | | |
| github.event.repository.fork == false && | |
| (github.ref_name == github.event.repository.default_branch || startsWith(github.ref, 'refs/tags/')) | |
| environment: | |
| name: feedz.io | |
| steps: | |
| - name: Download packages | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 | |
| with: | |
| name: packages-windows | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 # v4.3.1 | |
| with: | |
| dotnet-version: ${{ needs.build-test.outputs.dotnet-sdk-version }} | |
| # TODO Get the feedz.io token from Vault | |
| - name: Push NuGet packages to feedz.io | |
| shell: bash | |
| env: | |
| API_KEY: ${{ env.FEEDZ_IO_TOKEN }} | |
| SOURCE: 'https://f.feedz.io/${{ github.repository }}/nuget/index.json' | |
| run: dotnet nuget push "*.nupkg" --api-key "${API_KEY}" --skip-duplicate --source "${SOURCE}" |