-
Notifications
You must be signed in to change notification settings - Fork 0
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
Build NuGet packages in CI #9
Conversation
You'll notice the multi-step process in the GHA workflow for determining the version number. GitVersion has a GitHub Actions workflow step, |
Also omit the `${{ }}` since it's only *required* when the expression starts with `!` (which in YAML would mean "non-specific tag").
Note: for a workflow to actually use a NuGet package published to the GitHub registry, you may need to run a step like the following: dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/sillsdev/index.json" Where USERNAME, according to GitHub docs, should be "the username to be used when connecting to an authenticated source". It's unclear exactly what that means, but if I've understood it correctly, if the password is the GITHUB_TOKEN then the username is essentially ignored. |
I believe the `dotnet nuget push` command wants to interpret the `*.nuget` glob itself, rather than have the shell expand the glob.
Symbol packages include the .dll alongside the .pdb, so if you don't need the .pdb then the only downside is a larger-than-needed download. But since prerelease packages are what you're most likely to be trying to debug, it's helpful to have the .pdb included. This also avoids the "Package 'Foo.0.2.1.symbols.nupkg' already exists" error when the "Foo.0.2.1.nupkg" package was uploaded earlier in the process.
Just to check that it still works
Now that package write permission has been removed from the default permissions for the repo, this is now required for packages to upload.
This will end up creating a LOT of packages. We might want to consider whether to use something like https://github.com/actions/delete-package-versions to delete prerelease packages that have had 0 downloads and have a newer version available. Because although the storage limits on the GitHub package registry are generous, if we upload packages for every commit to every PR we're going to hit them sooner or later. Edit: Basically I want actions/delete-package-versions#12, which is an open feature request but should be doable. Maybe if we use the GitHub registry a lot I'll see about implementing that and sending a PR to that action. |
I think I'm going to scrap the publishing PR builds as it requires the consumers to have a github token on each machine that wants to restore the packages. Basically it's a big pain and there's probably better ways for us to do this. For now let's just have this PR build the nuget packages and upload them as artifacts without actually publishing them to a nuget repo |
Too much hassle to consume since it doesn't allow anonymous access, so anyone wanting to consume these packages, even if the packages are public, would have to set up NuGet auth and a GitHub API key.
Okay, commit 8438cd6 comments out the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to make this more maintainable by pulling all the inline bash scripting into a file so it can be easily tested locally. I'm find if it writes to an environment variable, but it should also write results to the console.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found a bug and left 1 suggestion.
I'd also like to document how this works, otherwise I'm going to forget, you can drop something in the end of the readme under a new development section to explain how the versioning tag works.
Whether running in GHA or by hand, the calculated version numbers should always be echoed to the console. Then we can remove the GHA workflow step that was doing the same thing.
Build NuGet packages in GitHub Actions CI, upload prerelease packages to GitHub registry and release packages to NuGet.org.
-PR###.buildnumber
-beta.buildnumber
-rc.buildnumber