-
Notifications
You must be signed in to change notification settings - Fork 0
GitHub Actions
The proces of creating nuget packages is automated in a Github action that triggers when you merge a PR to the master branch
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:
The code to invoke the GitHub Action is located in the source repo, typically in a file like release-nuget.yml
Example release-nuget.yml:
- Trigger: push to master
- runs-on: platform (e.g., windows-latest for multi-target)
- Calls a generic GitHub Action
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
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
Now, when a PR is created, a build is performed to check for errors. If there are errors, you can't merge the build.
If you want to package the library, you can get the cached build artifacts.