Merge branch 'main' of https://github.com/SimpleObservability/SimpleO… #6
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: Publish to Nuget.org and GPR | |
| on: | |
| push: | |
| tags: | |
| - "*.*.*" | |
| paths-ignore: | |
| - '.editorconfig' | |
| - 'ReadMe.md' | |
| - 'ChangeLog.md' | |
| - '.github/workflows/PullRequest.yml' | |
| - '.github/workflows/MergeToMain.yml' | |
| permissions: | |
| contents: write | |
| packages: write | |
| env: | |
| DOTNET_NOLOGO: true | |
| jobs: | |
| build_and_create_a_nuget: | |
| name: Build and Create a NuGet | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Calculate version from the Commit Tag | |
| run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| - name: Cache NuGet packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.nuget/packages | |
| key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nuget- | |
| - run: dotnet restore --verbosity minimal | |
| - run: dotnet build --configuration Release -p:ContinuousIntegrationBuild=true -p:DebugType=Embedded -p:version=${{ env.RELEASE_VERSION }} | |
| - run: dotnet pack --configuration Release --no-build --output ./artifacts -p:DebugType=Embedded -p:version=${{ env.RELEASE_VERSION }} | |
| - name: Publish artifacts | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: NuGetPackage.${{ env.RELEASE_VERSION }} | |
| path: ./artifacts/ | |
| - name: Upload release assets | |
| uses: softprops/action-gh-release@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| name: NuGetPackage.${{ env.RELEASE_VERSION }} | |
| files: ./artifacts/* | |
| publish_to_gpr: | |
| name: Publish to GitHub Package Registry | |
| runs-on: ubuntu-latest | |
| needs: build_and_create_a_nuget | |
| steps: | |
| - name: Calculate version from the Commit Tag | |
| run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v6 | |
| with: | |
| name: NuGetPackage.${{ env.RELEASE_VERSION }} | |
| path: ./artifacts/ | |
| - name: Publish to GPR | |
| run: | | |
| dotnet nuget push "./artifacts/*.nupkg" \ | |
| --no-symbols \ | |
| --api-key ${{ secrets.GITHUB_TOKEN }} \ | |
| --source https://nuget.pkg.github.com/${{ github.repository_owner }} | |
| publish_to_nuget: | |
| name: Publish to NuGet.org | |
| runs-on: ubuntu-latest | |
| needs: build_and_create_a_nuget | |
| steps: | |
| - name: Calculate version from the Commit Tag | |
| run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v6 | |
| with: | |
| name: NuGetPackage.${{ env.RELEASE_VERSION }} | |
| path: ./artifacts/ | |
| - name: Publish to nuget.org | |
| run: | | |
| dotnet nuget push "./artifacts/*.nupkg" \ | |
| --api-key ${{ secrets.NUGET_TOKEN }} \ | |
| --source https://api.nuget.org/v3/index.json |