NuGet Pkg for v0.6.0 using GitHub Actions by diogo-strube · Pull Request #262 · Thalhammer/jwt-cpp

@diogo-strube

This PR is related to discussion #243 and is a 3 file contribution:

  • nuget\jwt-cpp.nuspec contains all the descriptions of the NuGet package, including authors, and the path of files to be copied.
  • nuget\jwt-cpp.targets automatically set up the "additional include directories" when the package is installed.
  • .github\workflows\nuget.yml contains the GitHub Action to pack and pub the NuGet package.

Some context on the current approach:

  • As the version is already tracked by committed files (as shown in 🏷️ Set version to 0.6.0 #208), I left the version explicit in the .nuspec file (instead of using an environment variable or secret).
  • Publishing a NuGet pkg (to nugte.org) requires a token, the same was configured as a secret ${{ secrets.nuget_api_key }} in .github\workflows\nuget.yml.

prince-chrismc

# Controls when the workflow will run
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think manual is fine while we test, we can switch it later once we are more familiar with how it works.

prince-chrismc

- name: Setup NuGet.exe for use with actions
uses: NuGet/setup-nuget@v1.0.7
with:
nuget-api-key: ${{ secrets.nuget_api_key }}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need access to the Nuget package to make an API token? I made an account with the same user name if you don't mind :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, he needs to add one of us (or ideally both) as a owner for the package and we then need to create a secret here with the push token.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are the only one who can add secrets AFAIK, I dont have access to the settings page where they can be added

(my evil genius plan to steal power is working muahahah 😈 )

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont have access to the settings page where they can be added

Guess I need to add them myself then 😈

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added you both access as owners directly via NuGet.org so you can manage the package even before we publish the next one:
image
And the next commit will have you both added as owners in the .nuspec file, together with the version updated to a test one so you can experiment with running the workflow with your own token :)

@prince-chrismc

Looks super good just a few questions

Thalhammer

@diogo-strube

…to test for validatying workflow on Main

@diogo-strube

@Thalhammer and @prince-chrismc, with the latest commit you should be ready to configure the secret and try running the workflow, it will generate a pre-release package "-dev0.2" that we can do a final validation before publishing the release package.

@Thalhammer

@prince-chrismc Can you create a token for nuget ?
I can't cause I am not a co owner of the package but you seem to be now.

@prince-chrismc

should be in you inbox :)