Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub action to create release #18

Merged
merged 32 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
722b4d8
updates to csproj files
Heathermcx Jan 9, 2024
c98c40b
add public key for internals visible
Heathermcx Jan 9, 2024
9c43b5f
fix package versions
Heathermcx Jan 9, 2024
006d37e
add nuget config, brutal dev to blazor diagrams core
Heathermcx Jan 9, 2024
faf2289
only upload package created on build
Heathermcx Jan 11, 2024
bb9645f
update path to package
Heathermcx Jan 11, 2024
0d0fb50
add release github action
Heathermcx Jan 11, 2024
af1eb97
try auto increment version
Heathermcx Jan 11, 2024
fed637b
create release
Heathermcx Jan 11, 2024
0a153f6
fix format
Heathermcx Jan 11, 2024
4f12f36
add content type
Heathermcx Jan 11, 2024
eb5a165
try already uploaded package
Heathermcx Jan 11, 2024
e57c322
try a different action to create the release
Heathermcx Jan 11, 2024
54e8ef9
only create release on push to master or when manually triggered
Heathermcx Jan 11, 2024
46079e3
add script and instructions
Heathermcx Jan 11, 2024
f299e2d
remove commented code
Heathermcx Jan 11, 2024
22bf703
update instructions
Heathermcx Jan 11, 2024
f00537d
update naming in csproj
Heathermcx Jan 11, 2024
012f423
remove unused action, add comments to release action
Heathermcx Jan 18, 2024
21fdaa5
run action on push to PR so that I can check it works with latest cha…
Heathermcx Jan 18, 2024
c09cde6
remove versions from csproj - they dont seem to be needed
Heathermcx Jan 18, 2024
51515d0
Revert "run action on push to PR so that I can check it works with la…
Heathermcx Jan 18, 2024
87ec41b
always use release config, package path variable
Heathermcx Jan 22, 2024
4868905
add wtg as author
Heathermcx Jan 22, 2024
77094a3
remove version from version.props
Heathermcx Jan 22, 2024
289f0ed
run action on push to PR so that I can check it works with latest cha…
Heathermcx Jan 18, 2024
68b5bd8
add package version for TagToVersion
Heathermcx Jan 22, 2024
1ae4860
try add quotes for variable
Heathermcx Jan 22, 2024
687cb72
try use curly braces for variable
Heathermcx Jan 22, 2024
e6d2c81
try variables again
Heathermcx Jan 22, 2024
0b05a4f
fix typo
Heathermcx Jan 22, 2024
bf6ff36
Revert "run action on push to PR so that I can check it works with la…
Heathermcx Jan 22, 2024
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
8 changes: 2 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Heathermcx marked this conversation as resolved.
Show resolved Hide resolved
33 changes: 0 additions & 33 deletions .github/workflows/push.yml

This file was deleted.

61 changes: 61 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
AarthiNarayanan marked this conversation as resolved.
Show resolved Hide resolved
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 }}
AarthiNarayanan marked this conversation as resolved.
Show resolved Hide resolved

- name: Install dependencies
run: dotnet restore

# Pacakge is created on build
- name: Build
run: dotnet build --configuration Release
AarthiNarayanan marked this conversation as resolved.
Show resolved Hide resolved

# 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 }}
3 changes: 3 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Project>
<Import Project="build\Version.props" />
</Project>
26 changes: 26 additions & 0 deletions PushNuget.ps1
Original file line number Diff line number Diff line change
@@ -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))"
}
12 changes: 12 additions & 0 deletions WTGPublishPackageGuide.md
Original file line number Diff line number Diff line change
@@ -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.


5 changes: 5 additions & 0 deletions build/Version.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Project>
<PropertyGroup>
<Version></Version>
</PropertyGroup>
</Project>
6 changes: 6 additions & 0 deletions nuget.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="globalPackagesFolder" value=".\packages" />
</config>
</configuration>
16 changes: 8 additions & 8 deletions src/Blazor.Diagrams.Core/Blazor.Diagrams.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,19 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
AarthiNarayanan marked this conversation as resolved.
Show resolved Hide resolved
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Authors>zHaytam</Authors>
<Authors>zHaytam, WiseTech Global</Authors>
<Description>A fully customizable and extensible all-purpose diagrams library for Blazor</Description>
<AssemblyVersion>3.0.1</AssemblyVersion>
<FileVersion>3.0.1</FileVersion>
<RepositoryUrl>https://github.com/Blazor-Diagrams/Blazor.Diagrams</RepositoryUrl>
<Version>3.0.1</Version>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also be adding the Version?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package version is being managed by Version.props. The release.yml GitHub action uses the latest release to determine what version we are up to, increases the patch number by 1 and writes that to Version.props before the build so that we can automatically create the next version without manually increasing the version number.

<PackageId>Z.Blazor.Diagrams.Core</PackageId>
<RepositoryUrl>https://github.com/WiseTechGlobal/Blazor.Diagrams</RepositoryUrl>
<PackageId>WTG.Z.Blazor.Diagrams.Core</PackageId>
<PackageTags>blazor diagrams diagramming svg drag</PackageTags>
<Product>Z.Blazor.Diagrams.Core</Product>
<Product>WTG.Z.Blazor.Diagrams.Core</Product>
<PackageIcon>ZBD.png</PackageIcon>
<PackageProjectUrl>https://blazor-diagrams.zhaytam.com/</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>..\Blazor.Diagrams\sgKey.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
Expand All @@ -32,6 +31,7 @@

<ItemGroup>
<PackageReference Include="SvgPathProperties" Version="1.1.2" />
<PackageReference Include="Brutal.Dev.StrongNameSigner" Version="3.3.3" PrivateAssets="All"/>
</ItemGroup>

</Project>
7 changes: 3 additions & 4 deletions src/Blazor.Diagrams.Core/Diagram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
27 changes: 19 additions & 8 deletions src/Blazor.Diagrams/Blazor.Diagrams.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<Authors>zHaytam</Authors>
<Authors>zHaytam, WiseTech Global</Authors>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<AssemblyVersion>3.0.1</AssemblyVersion>
<FileVersion>3.0.1</FileVersion>
<RepositoryUrl>https://github.com/Blazor-Diagrams/Blazor.Diagrams</RepositoryUrl>
<RepositoryUrl>https://github.com/WiseTechGlobal/Blazor.Diagrams</RepositoryUrl>
<Description>A fully customizable and extensible all-purpose diagrams library for Blazor</Description>
<Version>3.0.1</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageTags>blazor diagrams diagramming svg drag</PackageTags>
<PackageId>Z.Blazor.Diagrams</PackageId>
<PackageId>WTG.Z.Blazor.Diagrams</PackageId>
<PackageProjectUrl>https://blazor-diagrams.zhaytam.com/</PackageProjectUrl>
<Product>Z.Blazor.Diagrams</Product>
<Product>WTG.Z.Blazor.Diagrams</Product>
<PackageIcon>ZBD.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>sgKey.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components" Version="6.0.25" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="6.0.25" />
<PackageReference Include="Brutal.Dev.StrongNameSigner" Version="3.3.3" PrivateAssets="All"/>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Blazor.Diagrams.Core\Blazor.Diagrams.Core.csproj" />
<ProjectReference Include="..\Blazor.Diagrams.Core\Blazor.Diagrams.Core.csproj" PrivateAssets="All"/>
</ItemGroup>

<ItemGroup>
Expand All @@ -50,4 +50,15 @@
<Exec Command="webcompiler -r wwwroot" StandardOutputImportance="high" StandardErrorImportance="high" />
</Target>

<PropertyGroup>
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);GetBinariesForPackage</TargetsForTfmSpecificBuildOutput>
</PropertyGroup>

<Target Name="GetBinariesForPackage">
<ItemGroup>
<BuildOutputInPackage Include="$(OutputPath)Blazor.Diagrams.Core.dll;..\..\packages\svgpathproperties\1.1.2\lib\netstandard2.0\SvgPathProperties.dll">
</BuildOutputInPackage>
</ItemGroup>
</Target>

</Project>
Binary file added src/Blazor.Diagrams/sgKey.snk
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\src\Blazor.Diagrams\sgKey.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
Expand Down
5 changes: 4 additions & 1 deletion tests/Blazor.Diagrams.Tests/Blazor.Diagrams.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\src\Blazor.Diagrams\sgKey.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="bunit" Version="1.4.15" />
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="Moq" Version="[4.18.4]" />
<PackageReference Include="Moq" Version="[4.18.4]" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand All @@ -25,6 +27,7 @@

<ItemGroup>
<ProjectReference Include="..\..\src\Blazor.Diagrams\Blazor.Diagrams.csproj" />
<ProjectReference Include="..\..\src\Blazor.Diagrams.Core\Blazor.Diagrams.Core.csproj" />
</ItemGroup>

</Project>
Loading