feat: add GitHub Actions workflows for code quality and automation (#2)

This commit is contained in:
2025-02-02 00:42:19 +02:00
committed by GitHub
parent af6ecdf6ca
commit 210aa969b3
105 changed files with 8807 additions and 408 deletions

36
csharp-publish/README.md Normal file
View File

@@ -0,0 +1,36 @@
# ivuorinen/actions/csharp-publish
## C# Publish
### Description
Publishes a C# project to GitHub Packages.
### Inputs
| name | description | required | default |
| ---------------- | ---------------------------------------- | -------- | ----------- |
| `dotnet-version` | <p>Version of .NET SDK to use.</p> | `false` | `""` |
| `namespace` | <p>GitHub namespace for the package.</p> | `true` | `ivuorinen` |
### Runs
This action is a `composite` action.
### Usage
```yaml
- 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
```

56
csharp-publish/action.yml Normal file
View File

@@ -0,0 +1,56 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/github-action.json
name: C# Publish
description: 'Publishes a C# project to GitHub Packages.'
author: 'Ismo Vuorinen'
branding:
icon: package
color: blue
inputs:
dotnet-version:
description: 'Version of .NET SDK to use.'
required: false
namespace:
description: 'GitHub namespace for the package.'
required: true
default: 'ivuorinen'
runs:
using: composite
steps:
- name: Detect .NET SDK Version
uses: ivuorinen/actions/dotnet-version-detect@main
with:
default-version: '7.0'
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '${{ steps.detect-dotnet-version.outputs.dotnet-version }}'
- name: Restore Dependencies
shell: bash
run: dotnet restore
- name: Build Solution
shell: bash
run: dotnet build --configuration Release --no-restore
- name: Pack Solution
shell: bash
run: dotnet pack --configuration Release --output ./artifacts
- name: Publish Package
shell: bash
run: dotnet nuget push ./artifacts/*.nupkg \
--api-key ${{ secrets.GITHUB_TOKEN }} \
--source "https://nuget.pkg.github.com/${{ inputs.namespace }}/index.json" \
--skip-duplicate \
--no-symbols \
|| (sleep 5 && dotnet nuget push ./artifacts/*.nupkg \
--api-key ${{ secrets.GITHUB_TOKEN }} \
--source "https://nuget.pkg.github.com/${{ inputs.namespace }}/index.json" \
--skip-duplicate \
--no-symbols)