Skip to content

GitHub Actions

Rikkert01 edited this page Oct 30, 2025 · 3 revisions

The proces of creating nuget packages is automated in a Github action that triggers when you merge a PR to the master branch

Packaging GitHub Action

Building, packaging, and pushing packages can be automated using GitHub Actions. I’ve created two actions that can be called from any project: Eii.GithubActions Repository

  • ReleaseNuGetPackageNet48Net80

Uses windows-latest to create multi-target .NET Framework 4.8 / .NET 8.0 packages.

  • ReleaseNuGetPackageNet80

Uses ubuntu-latest and can only build .NET 8.0 binaries.

Example of a multi-target package:

image

The code to invoke the GitHub Action is located in the source repo, typically in a file like release-nuget.yml

image

Example release-nuget.yml:

image
  1. Trigger: push to master
  2. runs-on: platform (e.g., windows-latest for multi-target)
  3. Calls a generic GitHub Action

Version Bumping

To bump a MINOR or MAJOR version, the GitHub Action uses the GitVersion component: GitVersion You can include the following commands in your commit message:

  • +semver: major → increases MAJOR
  • +semver: minor → increases MINOR
  • +semver: patch → increases PATCH

Build check GitHub Action

When a Pull Request is created, the branche is built to check for errors. When there are errors, the Pull Request cannot be merged.

To enable this gate, you must add a branche protection Rule.

  • Open the repo
  • click on 'Settings'
  • click on 'Branches'
  • the Branch name pattern must be 'master'
  • (The 'Require a pull request before merging' will be checked to prevent merging to 'master' without a PR.)
  • Place a check at 'Require status checks to pass before merging'
  • Place a check at 'Require branches to be up to date before merging'
  • In the 'Search for status checks...' type 'build' and click on the 'build' github action
image

Now, when a PR is created, a build is performed to check for errors. If there are errors, you can't merge the build.

image image

If you want to package the library, you can get the cached build artifacts.

Clone this wiki locally