From aa735ce3e3096f543f002dcfc9b164d6a0266566 Mon Sep 17 00:00:00 2001 From: Patrick Kurmann Date: Sun, 31 Mar 2024 12:50:40 +0200 Subject: [PATCH] added github workflow as template --- .../.github/workflows/dotnet.yml | 35 +++++++++++++++++ .../.template.config/template.json | 38 +++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 templates/nugetworkflow/.github/workflows/dotnet.yml create mode 100644 templates/nugetworkflow/.template.config/template.json diff --git a/templates/nugetworkflow/.github/workflows/dotnet.yml b/templates/nugetworkflow/.github/workflows/dotnet.yml new file mode 100644 index 0000000..215ba27 --- /dev/null +++ b/templates/nugetworkflow/.github/workflows/dotnet.yml @@ -0,0 +1,35 @@ +name: .NET CI/CD + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build_and_pack: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: Restore dependencies for Module + run: dotnet restore src/Module/Module.csproj + + # Optional: Ausführen der Tests + # - name: Test + # run: dotnet test src/Tests/Tests.csproj --no-build --verbosity normal + + - name: Pack Module + run: dotnet pack src/Module/Module.csproj --output ./nupkgs + + # Veröffentlichen der NuGet-Pakete + - name: Push NuGet and Symbol Packages + run: | + dotnet nuget push ./nupkgs/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate + dotnet nuget push ./nupkgs/*.snupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate diff --git a/templates/nugetworkflow/.template.config/template.json b/templates/nugetworkflow/.template.config/template.json new file mode 100644 index 0000000..b7c7652 --- /dev/null +++ b/templates/nugetworkflow/.template.config/template.json @@ -0,0 +1,38 @@ +{ + "$schema": "http://json.schemastore.org/template", + "author": "Patrick Kurmann", + "classifications": [ + "Common", + "GitHub Actions" + ], + "identity": "Kurmann.AutomateVideoPublishing.ServiceCollectionIntegratedModule.NuGetWorkflow", + "name": "Service Collection Integrated Module NuGet Workflow", + "shortName": "nugetworkflow", + "sourceName": "ServiceCollectionIntegratedModule.NuGetWorkflow", + "description": "Creates a GitHub Actions workflow for publishing a Service Collection Integrated Module to NuGet.org.", + "tags": { + "language": "YAML", + "type": "item" + }, + "preferNameDirectory": true, + "sources": [ + { + "modifiers": [ + { + "exclude": [ + ".vs/**", + ".template_config/**", + "**/bin/**", + "**/obj/**", + "/bin/**", + "/obj/**", + ".git/**", + "Readme.md", + "LICENSE", + "nuget.csproj" + ] + } + ] + } + ] +} \ No newline at end of file