Code Monkey home page Code Monkey logo

gha-dotnet-nuget's Introduction

GitHub Action: .NET Build/Test/Pack/Publish

This GitHub Action builds multi-targetted .NET libraries and pushes the packages to both the official NuGet and also the GitHub Actions packages feeds. This action is expecting to find a single .NET solution file (.sln) in the base of your repository - and one or more class libraries with <IsPackable>true</IsPackable> set in the csproj file.

Note: <IsPackable>true</IsPackable> is a default setting in a csproj file, so be sure to disable IsPackable for other projects via a Directory.Builds.Props file else these other projects will be pushed to the NuGet feed as well!

Currently configured for these .NET versions;

  • .NET 8.0.x

Examples

Minimal usage example;

steps:

- uses: f2calv/gha-dotnet-nuget@v1
  with:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Complete usage example;

steps:

- uses: f2calv/gha-dotnet-nuget@v1
  id: dotnet
  with:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    NUGET_API_KEY: ${{ secrets.GITHUB_TOKEN }}
    BuildConfiguration: Release

- run: |
    echo "SemVer=${{ steps.dotnet.outputs.SemVer }}"
    echo "FullSemVer=${{ steps.dotnet.outputs.FullSemVer }}"
    echo "BuildConfiguration=${{ steps.dotnet.outputs.BuildConfiguration }}"

Here are fully working examples of this action in active use in my own public repositories;

Inputs

  • GITHUB_TOKEN, built-in GitHub Actions token i.e. ${{ secrets.GITHUB_TOKEN }}, required parameter.
  • NUGET_API_KEY, API key for your public NuGet account i.e. ${{ secrets.NUGET_API_KEY }}, without this the NuGet package publish steps will be skipped.
  • BuildConfiguration, .NET Build configuration parameter i.e. Debug or Release, default is Release
  • PublishPreview, publish a pre-release package from a non-default branch - i.e. true or false, default is false

Outputs

  • SemVer, a simple semantic version created by the GitVersion tool, i.e. 1.2.3
  • FullSemVer, full semantic version plus branch name created by GitVersion tool, i.e. 1.2.3-feature-bugfix-123
  • BuildConfiguration, final build configuration that was used in the build, i.e. Debug or Release Note: Why? When passing in BuildConfiguration via a workflow_dispatch there is the potential for the inbound parameter to be an empty string.

gha-dotnet-nuget's People

Contributors

f2calv avatar

Stargazers

 avatar

Watchers

 avatar

gha-dotnet-nuget's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.