Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report generated NuGet package version to GitHub status #106

Merged
merged 26 commits into from
Mar 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Loading