Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/dotnet-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: All packages build

on:
push:
branches: [ main ]
pull_request:
branches:
- '**/*'

jobs:
build:

runs-on: ubuntu-latest
permissions:
packages: write

steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/parts/cache/

- name: Decode the Signing Key
# Generated via powershell: `[System.Convert]::ToBase64String([System.IO.File]::ReadAllBytes('.\Refactoring.snk')) | Set-Clipboard` and saved to GitHub Secrets SIGNING_KEY
run: |
if [ -n "${{ secrets.SIGNING_KEY }}" ]; then
echo "${{ secrets.SIGNING_KEY }}" | base64 --decode > ./Refactoring.snk
fi

###########
# BUILD
- name: Restore dependencies
run: dotnet restore
- name: Build
run: |
if [[ $VERSION_SUFFIX ]]; then
VERSION_SUFFIX_PARAM="--version-suffix sha.$VERSION_SUFFIX"
else
VERSION_SUFFIX_PARAM=''
fi
dotnet build --no-restore --configuration Release ${VERSION_SUFFIX_PARAM}
env:
VERSION_SUFFIX: ${{ github.ref != 'refs/heads/main' && github.sha || '' }}

###########
# TEST
- name: Test
run: |
if [[ $VERSION_SUFFIX ]]; then
VERSION_SUFFIX_PARAM="-p:VersionSuffix=sha.$VERSION_SUFFIX"
else
VERSION_SUFFIX_PARAM=''
fi
dotnet test --verbosity normal ${VERSION_SUFFIX_PARAM} --configuration Release --collect:"XPlat Code Coverage"
env:
VERSION_SUFFIX: ${{ github.ref != 'refs/heads/main' && github.sha || '' }}
- name: 'Upload Code Coverage'
uses: actions/upload-artifact@v4
with:
name: code-coverage
path: ./lib/*/TestResults/*/coverage.cobertura.xml
retention-days: 7
# - name: Record code coverage
# uses: 5monkeys/cobertura-action@master
# with:
# path: ./lib/*/TestResults/*/coverage.cobertura.xml
# repo_token: ${{ secrets.GITHUB_TOKEN }}
# minimum_coverage: 90
# fail_below_threshold: false

###########
# PUBLISH
- name: Publish NuGet packages to GitHub registry if new version number
if: ${{ github.ref != 'refs/heads/main' }}
run: dotnet nuget push ./artifacts/package/release/*.nupkg -k ${GITHUB_TOKEN} -s https://nuget.pkg.github.com/$GITHUB_REPOSITORY_OWNER/index.json --skip-duplicate --no-symbols
continue-on-error: true # Dependabot and other outside contributors can't push to our GitHub packages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish NuGet packages to NuGet registry if new version number
if: ${{ github.ref == 'refs/heads/main' }}
run: dotnet nuget push ./artifacts/package/release/*.nupkg -k ${NUGET_API_KEY} -s https://api.nuget.org/v3/index.json --skip-duplicate --no-symbols
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
19 changes: 19 additions & 0 deletions .github/workflows/parts/cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 'Package Cache'
description: 'Caches packages for this repository'
inputs: {}
outputs: {}
runs:
using: 'composite'
steps:
# .NET install and cache
- uses: actions/setup-dotnet@v3
with:
# The main version this project uses
dotnet-version: '10.0.x'

- uses: actions/cache@v3
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
10 changes: 5 additions & 5 deletions Directory.Build.Props → Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>

<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile Condition="exists('$(SolutionRoot)OpenApiCodegen.snk')">$(SolutionRoot)OpenApiCodegen.snk</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyFile Condition="exists('$(SolutionRoot)Refactoring.snk')">$(SolutionRoot)Refactoring.snk</AssemblyOriginatorKeyFile>
<NoWarn Condition="$(MSBuildProjectName.Contains('Test'))">$(NoWarn);CS8002;CA1054</NoWarn>
</PropertyGroup>

Expand All @@ -33,14 +33,14 @@
<Import Project="Directory.Build.local.props" Condition="exists('$(MSBuildThisFileDirectory)Directory.Build.local.props')" />

<PropertyGroup>
<Authors>Dark Patterns Digital, Principle Studios, Matt DeKrey, Tony Mishler, Chris Lees</Authors>
<PackageProjectUrl>https://github.com/darkpatternsdigital/openapi-generators</PackageProjectUrl>
<RepositoryUrl>https://github.com/darkpatternsdigital/openapi-generators.git</RepositoryUrl>
<Authors>Dark Patterns Digital, Matt DeKrey</Authors>
<PackageProjectUrl>https://github.com/darkpatternsdigital/DarkPatterns.Refactoring</PackageProjectUrl>
<RepositoryUrl>https://github.com/darkpatternsdigital/DarkPatterns.Refactoring.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<RepositoryBranch>main</RepositoryBranch>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<PackageIcon>dpd-logo.png</PackageIcon>
<Copyright>2026 Matt DeKrey; Dark Patterns Digital, LCA; &amp; Principle Studios</Copyright>
<Copyright>2026 Matt DeKrey; Dark Patterns Digital, LCA</Copyright>
<PackageLicenseExpression>BSD-2-Clause</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>
Expand Down
Loading