Skip to content

Commit c2d7520

Browse files
Update versioning and build to publish release versions to github
1 parent 6ef0c47 commit c2d7520

File tree

15 files changed

+206
-129
lines changed

15 files changed

+206
-129
lines changed

.github/workflows/dotnet-core.yml

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
# https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#github-context
1+
# https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
22
name: CI
33

44
on:
55
push:
66
branches: [ main ]
7+
tags:
8+
- '*.*.*'
79
pull_request:
810
branches: [ main ]
911

@@ -18,30 +20,51 @@ jobs:
1820
COMMIT_SHA: ${{ github.sha }}
1921

2022
steps:
21-
- uses: actions/checkout@v2
22-
with:
23-
fetch-depth: 0
23+
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
24+
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
25+
- run: echo "🔎 The name of your ${{ github.ref_type }} is ${{ github.ref }} and your repository is ${{ github.repository }}."
2426

25-
- name: setup dotnet
26-
uses: actions/setup-dotnet@v1
27-
with:
28-
dotnet-version: 6.0.101
29-
source-url: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
30-
env:
31-
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
27+
- name: checkout
28+
uses: actions/checkout@v2
29+
with:
30+
fetch-depth: 0
3231

33-
- name: dotnet restore
34-
run: dotnet restore
32+
- name: setup dotnet
33+
uses: actions/setup-dotnet@v1
34+
with:
35+
dotnet-version: 6.0.x
36+
source-url: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
37+
env:
38+
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
3539

36-
- name: dotnet build
37-
run: dotnet build --configuration Release --no-restore --nologo
40+
- name: dotnet restore
41+
run: dotnet restore
3842

39-
- name: dotnet pack
40-
run: dotnet pack -c Release -o dist --no-restore --no-build --nologo
43+
- name: dotnet build
44+
run: dotnet build --configuration Release --no-restore --nologo
4145

42-
- name: dotnet nuget push (github)
43-
run: dotnet nuget push "./dist/*.nupkg" --skip-duplicate
46+
- name: dotnet pack
47+
run: dotnet pack -c Release -o dist --no-restore --no-build --nologo
4448

45-
- name: dotnet nuget push (nuget)
46-
run: dotnet nuget push "./dist/*.nupkg" --skip-duplicate --source "nuget.org" --api-key ${{secrets.NUGET_API_KEY}}
47-
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
49+
- name: upload artifacts (github)
50+
uses: actions/upload-artifact@v2
51+
with:
52+
name: artifact
53+
path: dist
54+
55+
- name: dotnet nuget push (github)
56+
run: dotnet nuget push "./dist/*.nupkg" --skip-duplicate
57+
if: |
58+
github.event_name == 'push' &&
59+
(github.ref == 'refs/heads/main' || github.ref_type == 'tag')
60+
61+
- name: dotnet nuget push (nuget)
62+
run: dotnet nuget push "./dist/*.nupkg" --skip-duplicate --source "nuget.org" --api-key ${{secrets.NUGET_API_KEY}}
63+
if: github.event_name == 'push' && github.ref_type == 'tag'
64+
65+
- name: create release (github)
66+
uses: ncipollo/release-action@v1
67+
with:
68+
token: ${{ secrets.GITHUB_TOKEN }}
69+
artifacts: "dist/*.nupkg"
70+
if: github.event_name == 'push' && github.ref_type == 'tag'

BlazorStack.sln.DotSettings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/RazorCSharpFormat/RemoveThisQualifier/@EntryValue">True</s:Boolean>
3+
<s:String x:Key="/Default/CustomTools/CustomToolsData/@EntryValue"></s:String></wpf:ResourceDictionary>

Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<AnalysisLevel>latest</AnalysisLevel>
1818
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
1919
</PropertyGroup>
20-
20+
2121
<PropertyGroup Label="DotNet" Condition=" '$(CI)' == 'true' ">
2222
<NoWarn>$(NoWarn);0618</NoWarn>
2323
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
@@ -31,7 +31,6 @@
3131
<RepositoryUrl Condition=" '$(REPOSITORY_URL)' != '' ">$(REPOSITORY_URL)</RepositoryUrl>
3232
<PackageProjectUrl Condition=" '$(PROJECT_URL)' != '' ">$(PROJECT_URL)</PackageProjectUrl>
3333
<NeutralLanguage>en</NeutralLanguage>
34-
<PackageLicenseExpression>MIT</PackageLicenseExpression>
3534
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
3635
<PackageReadmeFile>README.md</PackageReadmeFile>
3736
</PropertyGroup>
@@ -47,6 +46,7 @@
4746

4847
<PropertyGroup Label="Versioning">
4948
<MinVerSkip Condition="'$(CI)' != 'true'">true</MinVerSkip>
49+
<MinVerDefaultPreReleasePhase>preview</MinVerDefaultPreReleasePhase>
5050
</PropertyGroup>
5151

5252
<ItemGroup Label="SourceLink" Condition=" '$(CI)' == 'true' ">
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
@code {
2-
[Parameter] public string label { get; set; } = default!;
3-
[Parameter] public bool value { get; set; }
2+
[Parameter] public string Label { get; set; } = default!;
3+
[Parameter] public bool Value { get; set; }
44

5-
[Parameter] public EventCallback<bool> valueChanged { get; set; }
5+
[Parameter] public EventCallback<bool> ValueChanged { get; set; }
66

7-
private async Task handleChange(ChangeEventArgs args) {
8-
value = Convert.ToBoolean(args.Value);
9-
await valueChanged.InvokeAsync(value);
7+
private async Task HandleChange(ChangeEventArgs args) {
8+
Value = Convert.ToBoolean(args.Value);
9+
await ValueChanged.InvokeAsync(Value);
1010
}
1111
}
1212

1313
<div>
14-
<label>@label:</label>
14+
<label>@Label:</label>
1515
<br />
16-
<input type="checkbox" checked="@value" @oninput="handleChange" />
16+
<input type="checkbox" checked="@Value" @oninput="HandleChange" />
1717
<br />
1818
</div>

samples/server/Components/Dropdown.razor

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
@typeparam TItem
22
@code {
3-
[Parameter] public string label { get; set; } = default!;
4-
[Parameter] public TItem value { get; set; } = default!;
3+
[Parameter] public string Label { get; set; } = default!;
4+
[Parameter] public TItem Value { get; set; } = default!;
55

6-
[Parameter] public EventCallback<TItem> valueChanged { get; set; }
6+
[Parameter] public EventCallback<TItem> ValueChanged { get; set; }
77

8-
private async Task handleChange(ChangeEventArgs args) {
8+
private async Task HandleChange(ChangeEventArgs args) {
99
var changedValue = args.Value?.ToString();
1010
if (changedValue is null) {
1111
return;
1212
}
1313

14-
value = (TItem)Enum.Parse(typeof(TItem), changedValue);
15-
await valueChanged.InvokeAsync(value);
14+
Value = (TItem)Enum.Parse(typeof(TItem), changedValue);
15+
await ValueChanged.InvokeAsync(Value);
1616
}
1717
}
1818

1919
<div>
20-
<label>@label:</label>
20+
<label>@Label:</label>
2121
<br />
22-
<select @onchange="handleChange">
22+
<select @onchange="HandleChange">
2323
@foreach (TItem enumValue in Enum.GetValues(typeof(TItem)))
2424
{
25-
<option value="@enumValue" selected="@object.Equals(enumValue, value)">@enumValue</option>
25+
<option value="@enumValue" selected="@Equals(enumValue, Value)">@enumValue</option>
2626
}
2727
</select>
2828
<br />
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
@code {
2-
[Parameter] public string label { get; set; } = default!;
3-
[Parameter] public int value { get; set; }
4-
[Parameter] public int min { get; set; }
5-
[Parameter] public int max { get; set; }
2+
[Parameter] public string Label { get; set; } = default!;
3+
[Parameter] public int Value { get; set; }
4+
[Parameter] public int Min { get; set; }
5+
[Parameter] public int Max { get; set; }
66

7-
[Parameter] public EventCallback<int> valueChanged { get; set; }
7+
[Parameter] public EventCallback<int> ValueChanged { get; set; }
88

9-
private async Task handleChange(ChangeEventArgs args) {
10-
value = Convert.ToInt32((string?)args.Value);
11-
await valueChanged.InvokeAsync(value);
9+
private async Task HandleChange(ChangeEventArgs args) {
10+
Value = Convert.ToInt32((string?)args.Value);
11+
await ValueChanged.InvokeAsync(Value);
1212
}
1313
}
1414

1515
<div>
16-
<label>@label: @value</label>
16+
<label>@Label: @Value</label>
1717
<br />
18-
<input type="range" min="@min" max="@max" value="@value" @oninput="handleChange" />
18+
<input type="range" min="@Min" max="@Max" value="@Value" @oninput="HandleChange" />
1919
<br />
2020
</div>

samples/server/Pages/Index.razor

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,31 @@
22
@code {
33
private int count = 20;
44
private bool horizontal = true;
5-
private int horizontalGap = 0;
6-
private int verticalGap = 0;
7-
private int gap = 0;
8-
private int maxWidth = 0;
9-
private int maxHeight = 0;
5+
private int horizontalGap;
6+
private int verticalGap;
7+
private int gap;
8+
private int maxWidth;
9+
private int maxHeight;
1010
private bool wrap = true;
11-
private bool reverse = false;
11+
private bool reverse;
1212
private StackAlignment horizontalAlignment = StackAlignment.Start;
1313
private StackAlignment verticalAlignment = StackAlignment.Start;
14-
15-
private void onchange() {
16-
StateHasChanged();
17-
}
1814
}
1915

2016
<h1>Stack</h1>
2117

2218
<Stack MaxHeight="300px" Wrap>
23-
<Slider label="Count" min="0" max="100" @bind-value="count" />
24-
<Dropdown label="Horizontal Alignment" TItem="StackAlignment" @bind-value="horizontalAlignment" />
25-
<Dropdown label="Vertical Alignment" TItem="StackAlignment" @bind-value="verticalAlignment" />
26-
<Checkbox label="Horizontal" @bind-value="horizontal" />
27-
<Slider label="Horizontal Gap" min="0" max="100" @bind-value="horizontalGap" />
28-
<Slider label="Vertical Gap" min="0" max="100" @bind-value="verticalGap" />
29-
<Slider label="Gap" min="0" max="100" @bind-value="gap" />
30-
<Slider label="Max Width" min="0" max="600" @bind-value="maxWidth" />
31-
<Slider label="Max Height" min="0" max="600" @bind-value="maxHeight" />
32-
<Checkbox label="Wrap" @bind-value="wrap" />
33-
<Checkbox label="Reverse" @bind-value="reverse" />
19+
<Slider Label="Count" Min="0" Max="100" @bind-value="count" />
20+
<Dropdown Label="Horizontal Alignment" TItem="StackAlignment" @bind-value="horizontalAlignment" />
21+
<Dropdown Label="Vertical Alignment" TItem="StackAlignment" @bind-value="verticalAlignment" />
22+
<Checkbox Label="Horizontal" @bind-value="horizontal" />
23+
<Slider Label="Horizontal Gap" Min="0" Max="100" @bind-value="horizontalGap" />
24+
<Slider Label="Vertical Gap" Min="0" Max="100" @bind-value="verticalGap" />
25+
<Slider Label="Gap" Min="0" Max="100" @bind-value="gap" />
26+
<Slider Label="Max Width" Min="0" Max="600" @bind-value="maxWidth" />
27+
<Slider Label="Max Height" Min="0" Max="600" @bind-value="maxHeight" />
28+
<Checkbox Label="Wrap" @bind-value="wrap" />
29+
<Checkbox Label="Reverse" @bind-value="reverse" />
3430
</Stack>
3531

3632
<div style="background-color: #71AFE5;">

samples/server/Program.cs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
namespace Sample.Server {
2-
public class Program {
3-
public static void Main(string[] args) {
4-
CreateHostBuilder(args).Build().Run();
5-
}
1+
using Sample.Server;
62

7-
public static IHostBuilder CreateHostBuilder(string[] args) =>
8-
Host.CreateDefaultBuilder(args)
9-
.ConfigureWebHostDefaults(webBuilder => {
10-
webBuilder.UseStartup<Startup>();
11-
});
12-
}
13-
}
3+
Host.CreateDefaultBuilder(args)
4+
.ConfigureWebHostDefaults(webBuilder => {
5+
webBuilder.UseStartup<Startup>();
6+
})
7+
.Build()
8+
.Run();

samples/server/Sample.Server.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>net6.0</TargetFramework>
5+
<GenerateDocumentationFile>false</GenerateDocumentationFile>
56
</PropertyGroup>
67

78
<ItemGroup>

samples/server/Startup.cs

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,38 @@
11
using System.Diagnostics;
22
using BlazorStyled;
33

4-
namespace Sample.Server {
5-
public class Startup {
6-
private readonly IConfiguration configuration;
7-
private readonly IWebHostEnvironment env;
8-
9-
public Startup(IConfiguration configuration, IWebHostEnvironment env) {
10-
this.configuration = configuration;
11-
this.env = env;
12-
}
13-
14-
public void ConfigureServices(IServiceCollection services) {
15-
services.AddRazorPages();
16-
services.AddServerSideBlazor();
17-
services.AddBlazorStyled(this.env.IsDevelopment(), Debugger.IsAttached);
18-
}
4+
namespace Sample.Server;
195

20-
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) {
21-
if (env.IsDevelopment()) {
22-
app.UseDeveloperExceptionPage();
23-
} else {
24-
app.UseExceptionHandler("/Error");
25-
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
26-
app.UseHsts();
27-
}
6+
public class Startup {
7+
private readonly IWebHostEnvironment env;
288

29-
app.UseHttpsRedirection();
30-
app.UseStaticFiles();
9+
public Startup(IWebHostEnvironment env) {
10+
this.env = env;
11+
}
3112

32-
app.UseRouting();
13+
public void ConfigureServices(IServiceCollection services) {
14+
services.AddRazorPages();
15+
services.AddServerSideBlazor();
16+
services.AddBlazorStyled(this.env.IsDevelopment(), Debugger.IsAttached);
17+
}
3318

34-
app.UseEndpoints(endpoints => {
35-
endpoints.MapBlazorHub();
36-
endpoints.MapFallbackToPage("/_Host");
37-
});
19+
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) {
20+
if (env.IsDevelopment()) {
21+
app.UseDeveloperExceptionPage();
22+
} else {
23+
app.UseExceptionHandler("/Error");
24+
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
25+
app.UseHsts();
3826
}
27+
28+
app.UseHttpsRedirection();
29+
app.UseStaticFiles();
30+
31+
app.UseRouting();
32+
33+
app.UseEndpoints(endpoints => {
34+
endpoints.MapBlazorHub();
35+
endpoints.MapFallbackToPage("/_Host");
36+
});
3937
}
4038
}

src/BlazorStack/BlazorStack.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
<PropertyGroup>
44
<TargetFrameworks>net5.0;net6.0;</TargetFrameworks>
55
<PackageTags>flex flexbox grid stack blazor ui component</PackageTags>
6+
<Description>
7+
A simple layout component for blazor that is based on Stack from FluentUI:
8+
https://developer.microsoft.com/en-us/fluentui#/controls/web/stack
9+
</Description>
610
</PropertyGroup>
711

812
<ItemGroup>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
2+
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=properties/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[assembly:CLSCompliant(false)]

0 commit comments

Comments
 (0)