Skip to content

Report generated NuGet package version to GitHub status #192

Report generated NuGet package version to GitHub status

Report generated NuGet package version to GitHub status #192

Workflow file for this run

name: Build for CI
on:
push:
branches: [ "main" ]
paths-ignore:
- "**.md"
pull_request:
branches: [ "main" ]
jobs:
build-plugin-ci:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Restore dependencies
run: dotnet restore src\Plugin.Maui.Audio\Plugin.Maui.Audio.csproj
- name: Build
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 }}
- 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
shell: bash
run: |
PR_NUMBER=$(echo "${{ github.event.pull_request.url }}" | awk -F/ '{print $NF}')
curl --request POST \
--url "https://api.github.com/repos/${{ github.repository }}/statuses/${PR_NUMBER}" \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/json' \
--data '{
"state": "success",
"context": "NuGet Package v3.0.0-preview2.${{ github.run_id }}${{ github.run_attempt }}",
"target_url": "https://jfversluis.pkgs.visualstudio.com/Plugin.Maui.Audio/_packaging/Plugin.Maui.Audio/nuget/v3/index.json"
}' \
--fail