diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 21dd859..cdbe8b1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,9 +10,10 @@ on: jobs: build-plugin-ci: - runs-on: windows-latest - + env: + NuGetVersion: "3.0.0-preview2.${{ github.run_id }}${{ github.run_attempt }}" + steps: - uses: actions/checkout@v4 @@ -23,10 +24,32 @@ jobs: run: dotnet build src\Plugin.Maui.Audio\Plugin.Maui.Audio.csproj -c Release - name: Pack - run: dotnet pack src\Plugin.Maui.Audio\Plugin.Maui.Audio.csproj -o output -p:PackageVersion=3.0.0-preview2.${{ github.run_id }}${{ github.run_attempt }} + run: dotnet pack src\Plugin.Maui.Audio\Plugin.Maui.Audio.csproj -o output -p:PackageVersion=${{ env.NuGetVersion }} - name: Add NuGet Source for Push run: dotnet nuget add source https://jfversluis.pkgs.visualstudio.com/Plugin.Maui.Audio/_packaging/Plugin.Maui.Audio/nuget/v3/index.json --name PrivateFeed --username ${{ secrets.PUBLISH_USER }} --password ${{ secrets.PUBLISH_PAT }} - name: Push run: dotnet nuget push "output\*.nupkg" --source PrivateFeed --api-key AzureArtifacts + + - name: Create status + if: success() + shell: bash + run: | + curl --request POST \ + --url https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }} \ + --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ + --header 'content-type: application/json' \ + --fail \ + --data-binary @- << EOF + { + "state": "success", + "context": "NuGet ${{ env.NuGetVersion }}", + "description": "Feed: https://jfversluis.pkgs.visualstudio.com/Plugin.Maui.Audio/_packaging/Plugin.Maui.Audio/nuget/v3/index.json", + "target_url": "https://github.com/jfversluis/Plugin.Maui.Audio/wiki/Preview-Packages", + "output": { + "title": "Install NuGets Generated by Pull Requests", + "summary": "A NuGet package has been generated as part of pull request #${{ github.event.number }}. Note that these versions do not necessarily represent (upcoming) releases so while it's great to test things out, make sure you don't use this NuGet in production, things might change later or not be merged at all. Please do let us know the findings from your testing with this! The URL for the NuGet feed is: https://jfversluis.pkgs.visualstudio.com/Plugin.Maui.Audio/_packaging/Plugin.Maui.Audio/nuget/v3/index.json. The version number of this NuGet package is: ${{ env.NuGetVersion }} Detailed instructions on how to add a NuGet feed to your Visual Studio can be found on [Microsoft Learn](https://learn.microsoft.com/azure/devops/artifacts/nuget/consume)." + } + } + EOF