diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml new file mode 100644 index 0000000..a9cd51c --- /dev/null +++ b/.github/workflows/nuget.yml @@ -0,0 +1,91 @@ +# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json +# The previous line enables IntelliSense for this file. +# See this post for more info https://www.meziantou.net/enabling-intellisense-for-github-actions-workflows-in-vs-code.htm + +name: Publish NuGet Package +on: + workflow_dispatch: + push: + branches: + - 'main' + pull_request: + branches: + - '*' + release: + types: + - published + +env: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + DOTNET_NOLOGO: true + NuGetDirectory: ${{ github.workspace }}/nuget + +defaults: + run: + shell: pwsh + +jobs: + create_nuget: + runs-on: windows-latest + env: + COMMIT_SHA: ${{ github.sha || github.event.pull_request.head.sha }} + steps: + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v3 + - run: | + If (('${{ github.event_name }}' -eq 'release') -and ('${{ github.ref_name }}' -match '^(?\d+\.\d+\.\d+)')) { + Add-Content -Path $Env:GITHUB_ENV -Value "VERSION=$($Matches.version)" + Add-Content -Path $Env:GITHUB_ENV -Value "FILE_VERSION=$($Matches.version).0" + Add-Content -Path $Env:GITHUB_ENV -Value "INFORMAL_VERSION=${{ github.ref_name }}" + } else { + Add-Content -Path $Env:GITHUB_ENV -Value "VERSION=0.0.0" + Add-Content -Path $Env:GITHUB_ENV -Value "FILE_VERSION=0.0.0.0" + Add-Content -Path $Env:GITHUB_ENV -Value "INFORMAL_VERSION=UNRELEASED" + } + name: "Set package version meta data" + - run: | + dotnet pack --configuration Release --output "${{ env.NuGetDirectory }}" --property:RepositoryCommit="${{ env.COMMIT_SHA }}" --property:InformationalVersion="${{ env.INFORMAL_VERSION }}" --property:AssemblyVersion="${{ env.VERSION }}" --property:FileVersion="${{ env.VERSION }}" --property:Version="${{ env.VERSION }}" + - uses: actions/upload-artifact@v3 + with: + name: nuget + if-no-files-found: error + retention-days: 7 + path: ${{ env.NuGetDirectory }}/*.nupkg + + validate_nuget: + runs-on: windows-latest + needs: [ create_nuget ] + steps: + - name: Setup .NET + uses: actions/setup-dotnet@v3 + - uses: actions/download-artifact@v3 + with: + name: nuget + path: ${{ env.NuGetDirectory }} + + - name: Install nuget validator + run: dotnet tool update Meziantou.Framework.NuGetPackageValidation.Tool --global + + # Validate the NuGet package: https://www.nuget.org/packages/Meziantou.Framework.NuGetPackageValidation.Tool#readme-body-tab + # If some rules are not applicable, you can disable them using the --excluded-rules or --excluded-rule-ids option + - name: Validate package + run: meziantou.validate-nuget-package --excluded-rules XmlDocumentationMustBePresent,Symbols (Get-ChildItem "${{ env.NuGetDirectory }}/*.nupkg") + + deploy: + # Publish only when creating a release + if: github.event_name == 'release' + runs-on: windows-latest + needs: [ validate_nuget ] + steps: + - uses: actions/download-artifact@v3 + with: + name: nuget + path: ${{ env.NuGetDirectory }} + - name: Setup .NET Core + uses: actions/setup-dotnet@v3 + - name: Publish NuGet package + run: | + foreach($file in (Get-ChildItem "${{ env.NuGetDirectory }}" -Recurse -Include *.nupkg)) { + dotnet nuget push $file --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json + } \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..7e8ee1e --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,24 @@ + + + + true + Apache-2.0 + icon.png + README.md + https://github.com/westermo/graphx + https://github.com/westermo/graphx + git + wpf, controls-library, graphing + $([System.DateTime]::Now.ToString(yyyy)) + Westermo Network Technologies AB + Copyright © Westermo Network Technologies AB $(CurrentYear), and Alexander Smirnov (derivative work of https://github.com/panthernet/GraphX) + Westermo Network Technologies AB + + + + + + + + + \ No newline at end of file diff --git a/Examples/ShowcaseApp.WPF/ShowcaseApp.WPF.csproj b/Examples/ShowcaseApp.WPF/ShowcaseApp.WPF.csproj index 7b1171f..e19a690 100644 --- a/Examples/ShowcaseApp.WPF/ShowcaseApp.WPF.csproj +++ b/Examples/ShowcaseApp.WPF/ShowcaseApp.WPF.csproj @@ -6,10 +6,11 @@ net6.0-windows latest true + false - GraphX ShowcaseApp.WPF + Westermo GraphX ShowcaseApp.WPF diff --git a/Examples/SimpleGraph/SimpleGraph.csproj b/Examples/SimpleGraph/SimpleGraph.csproj index 8494c1b..e78d018 100644 --- a/Examples/SimpleGraph/SimpleGraph.csproj +++ b/Examples/SimpleGraph/SimpleGraph.csproj @@ -5,6 +5,11 @@ net6.0-windows true SimpleGraph + false + + + + Westermo GraphX SimpleGraph diff --git a/Westermo.GraphX.Common/Westermo.GraphX.Common.csproj b/Westermo.GraphX.Common/Westermo.GraphX.Common.csproj index 038db4f..0d11b13 100644 --- a/Westermo.GraphX.Common/Westermo.GraphX.Common.csproj +++ b/Westermo.GraphX.Common/Westermo.GraphX.Common.csproj @@ -10,5 +10,11 @@ + + + + Westermo GraphX Controls Library (Support library) + Support library for Westermo.GraphX.Controls + \ No newline at end of file diff --git a/Westermo.GraphX.Controls/Westermo.GraphX.Controls.csproj b/Westermo.GraphX.Controls/Westermo.GraphX.Controls.csproj index 57fdfd7..042a8b3 100644 --- a/Westermo.GraphX.Controls/Westermo.GraphX.Controls.csproj +++ b/Westermo.GraphX.Controls/Westermo.GraphX.Controls.csproj @@ -7,10 +7,6 @@ enable Westermo.GraphX.Controls - - - GraphX Controls Library - $(DefineConstants);TRACE;WPF @@ -27,4 +23,10 @@ + + + Westermo GraphX Controls Library + WPF Controls Library + + diff --git a/Westermo.GraphX.Logic/Westermo.GraphX.Logic.csproj b/Westermo.GraphX.Logic/Westermo.GraphX.Logic.csproj index 7fb2752..8bae496 100644 --- a/Westermo.GraphX.Logic/Westermo.GraphX.Logic.csproj +++ b/Westermo.GraphX.Logic/Westermo.GraphX.Logic.csproj @@ -11,4 +11,10 @@ + + + Westermo GraphX Controls Library (Support library) + Support library for Westermo.GraphX.Controls + + \ No newline at end of file diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..ea970ff Binary files /dev/null and b/icon.png differ