diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 98fc1e5c..1accd03d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,14 +34,10 @@ jobs: if: matrix.configuration == 'Debug' run: dotnet test --no-build - - name: Pack - if: matrix.configuration == 'Release' - run: dotnet pack --configuration ${{ matrix.configuration }} -o packages --no-build - - name: Upload packages if: matrix.configuration == 'Release' uses: actions/upload-artifact@v3 with: - name: packages - path: packages/ + name: package + path: /home/runner/work/Blazor.Diagrams/Blazor.Diagrams/src/Blazor.Diagrams/bin/Release/*.nupkg retention-days: 5 diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml deleted file mode 100644 index d15fccc3..00000000 --- a/.github/workflows/push.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: PushToNuget -env: - NUGET_DIR: '${{ github.workspace }}/nuget' - -on: - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Pack Blazor.Diagrams.Core - working-directory: src/Blazor.Diagrams.Core - run: 'dotnet pack -p:GeneratePackageOnBuild=false --configuration Release --output ${{ env.NUGET_DIR }}' - - - name: Pack Blazor.Diagrams - working-directory: src/Blazor.Diagrams - run: 'dotnet pack -p:GeneratePackageOnBuild=false --configuration Release --output ${{ env.NUGET_DIR }}' - - - name: Pack Blazor.Diagrams.Algorithms - working-directory: src/Blazor.Diagrams.Algorithms - run: 'dotnet pack -p:GeneratePackageOnBuild=false --configuration Release --output ${{ env.NUGET_DIR }}' - - - name: Push Blazor.Diagrams.Core - run: 'dotnet nuget push ${{ env.NUGET_DIR }}/Z.Blazor.Diagrams.Core.3.0.1.nupkg --api-key "${{ secrets.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate' - - - name: Push Blazor.Diagrams - run: 'dotnet nuget push ${{ env.NUGET_DIR }}/Z.Blazor.Diagrams.3.0.1.nupkg --api-key "${{ secrets.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate' - - - name: Push Blazor.Diagrams.Algorithms - run: 'dotnet nuget push ${{ env.NUGET_DIR }}/Z.Blazor.Diagrams.Algorithms.3.0.1.nupkg --api-key "${{ secrets.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..6ce136ca --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,61 @@ +name: Create release +# On push to master branch. i.e. when we merge a PR. +on: + push: + branches: [ master ] + workflow_dispatch: + +env: + PACKAGE_PATH: /home/runner/work/Blazor.Diagrams/Blazor.Diagrams/src/Blazor.Diagrams/bin/Release/*.nupkg + +jobs: + build: + name: Build - Release + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Setup dotnet + uses: actions/setup-dotnet@v3 + with: + dotnet-version: | + 6.0.x + 3.1.x + + # Finds the latest release and increases the version + - name: Get next version + uses: reecetech/version-increment@2023.9.3 + id: version + with: + scheme: semver + increment: patch + + - name: Install version tool + run: dotnet tool install dotnetCampus.TagToVersion -g --version 1.0.11 + + # Writes the new version number to build/Version.props + - name: Set version + run: dotnet TagToVersion -t ${{ steps.version.outputs.version }} + + - name: Install dependencies + run: dotnet restore + + # Pacakge is created on build + - name: Build + run: dotnet build --configuration Release + + # Upload package as an atrifact to the GitHub action + - name: Upload packages + uses: actions/upload-artifact@v3 + with: + name: package + path: ${{ env.PACKAGE_PATH }} + retention-days: 5 + + # Create a new release and upload the package to the release + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: ${{ env.PACKAGE_PATH }} + tag_name: ${{ steps.version.outputs.version }} diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 00000000..2c52bf20 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/PushNuget.ps1 b/PushNuget.ps1 new file mode 100644 index 00000000..eb16a480 --- /dev/null +++ b/PushNuget.ps1 @@ -0,0 +1,26 @@ +pushd $PSScriptRoot + +$feedSource = "http://proget.wtg.zone/nuget/WTG-Internal/" +$apiKey = "" +$packagePath = "*.nupkg" + +function Write-Log { + Write-Host "$(get-date -f "yyyy-MM-dd HH:mm:ss.fff")`t$args" +} + +try { + $scriptSw = [System.Diagnostics.Stopwatch]::StartNew() + & nuget.exe push $packagePath -ApiKey $apiKey -Source $feedSource -Verbosity detailed + if (-not $?) + { + Write-Log "FAILED to deploy: $packagePath)" + } + else + { + Write-Log "Deployed $packagePath )" + } +} +finally { + popd + Write-Log "Finished (took: $($scriptSw.Elapsed))" +} \ No newline at end of file diff --git a/WTGPublishPackageGuide.md b/WTGPublishPackageGuide.md new file mode 100644 index 00000000..462fc9c8 --- /dev/null +++ b/WTGPublishPackageGuide.md @@ -0,0 +1,12 @@ +# Publishing WTG.Z.Blazor.Diagrams for WTG usage +This doc explains how the package we use at WTG is updated. + +When a PR is merged to master, the GitHub Action 'Create release' should run. It can also be run manually if needed. This action creates a GitHub Release and uploads the package to the release. The version number is also handled by the action. The package is created on build in the action and should contain Blazor.Diagrams.dll, Blazor.Diagrams.Core.dll and SvgPathProperties.dll + +## To push package to proget +1. **Find the release**. Most likely the most recent release is the one to use. To find all releases, go to the repo main page then click 'Releases'. +2. **Download the package**. Expand the 'Assets' section of the release and download the *.nupkg file. +3. **Push to proget**. Modify the PushNuget.ps1 script so that it had the correct path to the downloaded *.nupkg file and the API key. Ask another team member if not sure. Once the script has all required information, run the script to push the package. +4. **Update package version in WTG**. In Directory.Packages.Props, update the version of WTG.Z.Blazor.Diagrams to match the package that was just uploaded to proget. + + diff --git a/build/Version.props b/build/Version.props new file mode 100644 index 00000000..2420175e --- /dev/null +++ b/build/Version.props @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/nuget.config b/nuget.config new file mode 100644 index 00000000..8d053120 --- /dev/null +++ b/nuget.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/Blazor.Diagrams.Core/Blazor.Diagrams.Core.csproj b/src/Blazor.Diagrams.Core/Blazor.Diagrams.Core.csproj index cb81f620..163567b7 100644 --- a/src/Blazor.Diagrams.Core/Blazor.Diagrams.Core.csproj +++ b/src/Blazor.Diagrams.Core/Blazor.Diagrams.Core.csproj @@ -3,20 +3,19 @@ net6.0 enable - true + false MIT - zHaytam + zHaytam, WiseTech Global A fully customizable and extensible all-purpose diagrams library for Blazor - 3.0.1 - 3.0.1 - https://github.com/Blazor-Diagrams/Blazor.Diagrams - 3.0.1 - Z.Blazor.Diagrams.Core + https://github.com/WiseTechGlobal/Blazor.Diagrams + WTG.Z.Blazor.Diagrams.Core blazor diagrams diagramming svg drag - Z.Blazor.Diagrams.Core + WTG.Z.Blazor.Diagrams.Core ZBD.png https://blazor-diagrams.zhaytam.com/ README.md + True + ..\Blazor.Diagrams\sgKey.snk @@ -32,6 +31,7 @@ + diff --git a/src/Blazor.Diagrams.Core/Diagram.cs b/src/Blazor.Diagrams.Core/Diagram.cs index 61b8b09f..99e43bcd 100644 --- a/src/Blazor.Diagrams.Core/Diagram.cs +++ b/src/Blazor.Diagrams.Core/Diagram.cs @@ -12,10 +12,9 @@ using Blazor.Diagrams.Core.Controls; using Blazor.Diagrams.Core.Behaviors.Base; -[assembly: InternalsVisibleTo("Blazor.Diagrams")] -[assembly: InternalsVisibleTo("Blazor.Diagrams.Tests")] -[assembly: InternalsVisibleTo("Blazor.Diagrams.Core.Tests")] - +[assembly: InternalsVisibleTo("Blazor.Diagrams, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b19ccf452d560c78a01faeff3ea2dd095ebc2b24abb6ce02394e44ecc5fad730037d475c0678cbfc201a727462866c8148fe30e0171816b7569e0d0e74f01d741cd84dfde651f0d817a74e1121566b66759566601eceaf504566c83a9c1fd9b574c48652f0e183919f951e5dd39085964a6bb4bb1edf3c15226acab7d73bf7cf")] +[assembly: InternalsVisibleTo("Blazor.Diagrams.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b19ccf452d560c78a01faeff3ea2dd095ebc2b24abb6ce02394e44ecc5fad730037d475c0678cbfc201a727462866c8148fe30e0171816b7569e0d0e74f01d741cd84dfde651f0d817a74e1121566b66759566601eceaf504566c83a9c1fd9b574c48652f0e183919f951e5dd39085964a6bb4bb1edf3c15226acab7d73bf7cf")] +[assembly: InternalsVisibleTo("Blazor.Diagrams.Core.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b19ccf452d560c78a01faeff3ea2dd095ebc2b24abb6ce02394e44ecc5fad730037d475c0678cbfc201a727462866c8148fe30e0171816b7569e0d0e74f01d741cd84dfde651f0d817a74e1121566b66759566601eceaf504566c83a9c1fd9b574c48652f0e183919f951e5dd39085964a6bb4bb1edf3c15226acab7d73bf7cf")] namespace Blazor.Diagrams.Core; public abstract class Diagram diff --git a/src/Blazor.Diagrams/Blazor.Diagrams.csproj b/src/Blazor.Diagrams/Blazor.Diagrams.csproj index 3e806eb7..c674d4a8 100644 --- a/src/Blazor.Diagrams/Blazor.Diagrams.csproj +++ b/src/Blazor.Diagrams/Blazor.Diagrams.csproj @@ -3,29 +3,29 @@ net6.0 enable - zHaytam + zHaytam, WiseTech Global MIT - 3.0.1 - 3.0.1 - https://github.com/Blazor-Diagrams/Blazor.Diagrams + https://github.com/WiseTechGlobal/Blazor.Diagrams A fully customizable and extensible all-purpose diagrams library for Blazor - 3.0.1 true blazor diagrams diagramming svg drag - Z.Blazor.Diagrams + WTG.Z.Blazor.Diagrams https://blazor-diagrams.zhaytam.com/ - Z.Blazor.Diagrams + WTG.Z.Blazor.Diagrams ZBD.png README.md + True + sgKey.snk + - + @@ -50,4 +50,15 @@ + + $(TargetsForTfmSpecificBuildOutput);GetBinariesForPackage + + + + + + + + + diff --git a/src/Blazor.Diagrams/sgKey.snk b/src/Blazor.Diagrams/sgKey.snk new file mode 100644 index 00000000..4ff3c2f7 Binary files /dev/null and b/src/Blazor.Diagrams/sgKey.snk differ diff --git a/tests/Blazor.Diagrams.Core.Tests/Blazor.Diagrams.Core.Tests.csproj b/tests/Blazor.Diagrams.Core.Tests/Blazor.Diagrams.Core.Tests.csproj index 0e1f0d2f..11c8ea2c 100644 --- a/tests/Blazor.Diagrams.Core.Tests/Blazor.Diagrams.Core.Tests.csproj +++ b/tests/Blazor.Diagrams.Core.Tests/Blazor.Diagrams.Core.Tests.csproj @@ -4,6 +4,8 @@ net6.0 enable false + True + ..\..\src\Blazor.Diagrams\sgKey.snk diff --git a/tests/Blazor.Diagrams.Tests/Blazor.Diagrams.Tests.csproj b/tests/Blazor.Diagrams.Tests/Blazor.Diagrams.Tests.csproj index dead3f03..a2895c11 100644 --- a/tests/Blazor.Diagrams.Tests/Blazor.Diagrams.Tests.csproj +++ b/tests/Blazor.Diagrams.Tests/Blazor.Diagrams.Tests.csproj @@ -5,6 +5,8 @@ enable false true + True + ..\..\src\Blazor.Diagrams\sgKey.snk @@ -12,7 +14,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all @@ -25,6 +27,7 @@ +