Files
actions/csharp-publish
Ismo Vuorinen 328472b5da refactor: inline .NET detection into csharp actions
Replace language-version-detect dependency with inline version detection
for all three C# actions (csharp-build, csharp-lint-check, csharp-publish).

Detection logic checks (in priority order):
- .tool-versions file (dotnet key)
- Dockerfile (FROM dotnet: image)
- devcontainer.json (dotnet: image)
- global.json (.sdk.version field)

Implementation details:
- POSIX sh compliant with `set -eu`
- Validates version format: X, X.Y, or X.Y.Z
- Normalizes versions: strips 'v' prefix, whitespace, line endings
- Uses `sed -E` for portable extended regex
- Conditional jq usage with diagnostic messages
- Maintains output contract (detected-version)

Fixed issues from code review:
- devcontainer.json sed regex: malformed wildcard ('. */' → '.*')
- Dockerfile sed regex: removed unintended leading space (' \1' → '\1')
- Added stderr diagnostics when jq is not found
- Applied fixes to all three actions for consistency

Changes:
- csharp-build: ~100 lines of inline detection + jq diagnostics
- csharp-lint-check: ~100 lines of inline detection + jq diagnostics
- csharp-publish: ~100 lines of inline detection + jq diagnostics
- All READMEs regenerated with action-docs

Benefits:
- Eliminates external dependency for .NET version detection
- Reduces action initialization time
- Improved debugging (diagnostic messages, all logic in one file)
- Consistent with go-build pattern
2025-11-20 10:10:22 +02:00
..

ivuorinen/actions/csharp-publish

C# Publish

Description

Publishes a C# project to GitHub Packages.

Inputs

name description required default
dotnet-version

Version of .NET SDK to use.

false ""
namespace

GitHub namespace for the package.

true ivuorinen
token

GitHub token with package write permissions

false ""

Outputs

name description
publish_status

Overall publish status (success/failure)

package_version

Version of the published package

package_url

URL of the published package

Runs

This action is a composite action.

Usage

- uses: ivuorinen/actions/csharp-publish@main
  with:
    dotnet-version:
    # Version of .NET SDK to use.
    #
    # Required: false
    # Default: ""

    namespace:
    # GitHub namespace for the package.
    #
    # Required: true
    # Default: ivuorinen

    token:
    # GitHub token with package write permissions
    #
    # Required: false
    # Default: ""