Skip to content

Commit 9354fcb

Browse files
authored
Merge pull request #5 from NetCoreTemplates/net10
Net10
2 parents 26a6d20 + d6c2be5 commit 9354fcb

File tree

13 files changed

+2611
-2534
lines changed

13 files changed

+2611
-2534
lines changed

.github/workflows/build-container.yml

Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ on:
1515
# Only update envs here if you need to change them for this workflow
1616
env:
1717
DOCKER_BUILDKIT: 1
18-
KAMAL_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
19-
KAMAL_REGISTRY_USERNAME: ${{ github.actor }}
18+
KAMAL_DEPLOY_HOST: ${{ secrets.KAMAL_DEPLOY_HOST }}
2019

2120
jobs:
2221
build-container:
@@ -33,6 +32,24 @@ jobs:
3332
echo "repository_name_lower=$(echo ${{ github.repository }} | cut -d '/' -f 2 | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
3433
echo "org_name=$(echo ${{ github.repository }} | cut -d '/' -f 1)" >> $GITHUB_ENV
3534
35+
# Set SERVICE_LABEL: derive from GITHUB_REPOSITORY (replace dots with dashes)
36+
echo "SERVICE_LABEL=$(echo ${{ github.repository }} | cut -d '/' -f 2 | tr '.' '-')" >> $GITHUB_ENV
37+
38+
# Set KAMAL_DEPLOY_HOST: use secret if available, otherwise use repository name
39+
if [ -n "${{ secrets.KAMAL_DEPLOY_HOST }}" ]; then
40+
DEPLOY_HOST="${{ secrets.KAMAL_DEPLOY_HOST }}"
41+
else
42+
DEPLOY_HOST="$(echo ${{ github.repository }} | cut -d '/' -f 2)"
43+
fi
44+
45+
# Validate KAMAL_DEPLOY_HOST contains at least one '.'
46+
if [[ ! "$DEPLOY_HOST" == *.* ]]; then
47+
echo "Error: KAMAL_DEPLOY_HOST must contain a hostname, e.g. example.com (got: $DEPLOY_HOST)"
48+
exit 1
49+
fi
50+
51+
echo "KAMAL_DEPLOY_HOST=$DEPLOY_HOST" >> $GITHUB_ENV
52+
3653
# This step is for the deployment of the templates only, safe to delete
3754
- name: Modify csproj for template deploy
3855
env:
@@ -45,25 +62,26 @@ jobs:
4562
id: check_client
4663
run: |
4764
if [ -d "MyApp.Client" ] && [ -f "MyApp.Client/package.json" ]; then
48-
echo "requires_npm=true" >> $GITHUB_OUTPUT
65+
echo "client_exists=true" >> $GITHUB_OUTPUT
66+
else
67+
echo "client_exists=false" >> $GITHUB_OUTPUT
4968
fi
5069
5170
- name: Setup Node.js
52-
if: steps.check_client.outputs.requires_npm == 'true'
53-
uses: actions/setup-node@v6
71+
if: steps.check_client.outputs.client_exists == 'true'
72+
uses: actions/setup-node@v3
5473
with:
5574
node-version: 24
5675

5776
- name: Install npm dependencies
58-
if: steps.check_client.outputs.requires_npm == 'true'
77+
if: steps.check_client.outputs.client_exists == 'true'
5978
working-directory: ./MyApp.Client
6079
run: npm install
6180

62-
- name: Install tailwindcss
63-
run: |
64-
mkdir -p /home/runner/.local/bin
65-
curl -o "/home/runner/.local/bin/tailwindcss" -L "https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64"
66-
chmod +x /home/runner/.local/bin/tailwindcss
81+
- name: Build client
82+
if: steps.check_client.outputs.client_exists == 'true'
83+
working-directory: ./MyApp.Client
84+
run: npm run build
6785

6886
- name: Install x tool
6987
run: dotnet tool install -g x
@@ -83,14 +101,21 @@ jobs:
83101
uses: docker/login-action@v3
84102
with:
85103
registry: ghcr.io
86-
username: ${{ env.KAMAL_REGISTRY_USERNAME }}
87-
password: ${{ env.KAMAL_REGISTRY_PASSWORD }}
104+
username: ${{ github.actor }}
105+
password: ${{ secrets.GITHUB_TOKEN }}
88106

89107
- name: Setup .NET
90108
uses: actions/setup-dotnet@v5
91109
with:
92-
dotnet-version: 8.0.x
110+
dotnet-version: 10.0.x
93111

94112
- name: Build and push Docker image
113+
env:
114+
SERVICESTACK_LICENSE: ${{ secrets.SERVICESTACK_LICENSE }}
115+
KAMAL_DEPLOY_HOST: ${{ secrets.KAMAL_DEPLOY_HOST }}
95116
run: |
96-
dotnet publish --os linux --arch x64 -c Release -p:ContainerRepository=${{ env.image_repository_name }} -p:ContainerRegistry=ghcr.io -p:ContainerImageTags=latest -p:ContainerPort=80
117+
dotnet publish --os linux --arch x64 -c Release \
118+
-p:ContainerRepository=${{ env.image_repository_name }} \
119+
-p:ContainerRegistry=ghcr.io -p:ContainerImageTags=latest \
120+
-p:ContainerPort=80 \
121+
-p:ContainerEnvironmentVariable="SERVICESTACK_LICENSE=${{ env.SERVICESTACK_LICENSE }}"

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
name: Build
23

34
on:

MyApp.ServiceInterface/MyApp.ServiceInterface.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.*" />
11-
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.*" />
12-
<PackageReference Include="ServiceStack" Version="8.*" />
13-
<PackageReference Include="ServiceStack.Ormlite" Version="8.*" />
10+
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="10.*" />
11+
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="10.*" />
12+
<PackageReference Include="ServiceStack" Version="10.*" />
13+
<PackageReference Include="ServiceStack.Ormlite" Version="10.*" />
1414
</ItemGroup>
1515

1616
<ItemGroup>

MyApp.ServiceModel/MyApp.ServiceModel.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="ServiceStack.Interfaces" Version="8.*" />
10+
<PackageReference Include="ServiceStack.Interfaces" Version="10.*" />
1111
</ItemGroup>
1212

1313
<ItemGroup>

MyApp.Tests/MyApp.Tests.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
<ProjectReference Include="..\MyApp.ServiceModel\MyApp.ServiceModel.csproj" />
1414
<ProjectReference Include="..\MyApp\MyApp.csproj" />
1515

16-
<PackageReference Include="NUnit" Version="3.*" />
17-
<PackageReference Include="NUnit3TestAdapter" Version="4.*" />
18-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.*" />
19-
<PackageReference Include="ServiceStack" Version="8.*" />
20-
<PackageReference Include="ServiceStack.Kestrel" Version="8.*" />
16+
<PackageReference Include="NUnit" Version="4.*" />
17+
<PackageReference Include="NUnit3TestAdapter" Version="5.*" />
18+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.*" />
19+
<PackageReference Include="ServiceStack" Version="10.*" />
20+
<PackageReference Include="ServiceStack.Kestrel" Version="10.*" />
2121
</ItemGroup>
2222

2323
</Project>

MyApp/MyApp.csproj

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@
2727
</ItemGroup>
2828

2929
<ItemGroup>
30-
<PackageReference Include="ServiceStack" Version="8.*" />
31-
<PackageReference Include="ServiceStack.Jobs" Version="8.*" />
32-
<PackageReference Include="ServiceStack.Server" Version="8.*" />
33-
<PackageReference Include="ServiceStack.OrmLite.Sqlite.Data" Version="8.*" />
34-
<PackageReference Include="ServiceStack.Extensions" Version="8.*" />
35-
<PackageReference Include="ServiceStack.Blazor" Version="8.*" />
36-
<PackageReference Include="ServiceStack.AI.Chat" Version="8.*" />
37-
<PackageReference Include="ServiceStack.OpenApi.Swashbuckle" Version="8.10.1" />
30+
<PackageReference Include="ServiceStack" Version="10.*" />
31+
<PackageReference Include="ServiceStack.Jobs" Version="10.*" />
32+
<PackageReference Include="ServiceStack.Server" Version="10.*" />
33+
<PackageReference Include="ServiceStack.OrmLite.Sqlite.Data" Version="10.*" />
34+
<PackageReference Include="ServiceStack.Extensions" Version="10.*" />
35+
<PackageReference Include="ServiceStack.Blazor" Version="10.*" />
36+
<PackageReference Include="ServiceStack.AI.Chat" Version="10.*" />
37+
<PackageReference Include="ServiceStack.OpenApi.Swashbuckle" Version="10.*" />
3838
</ItemGroup>
3939

4040
<ItemGroup>
@@ -49,12 +49,23 @@
4949
<Content Include="_videos\**" CopyToPublishDirectory="PreserveNewest" />
5050
</ItemGroup>
5151

52+
<PropertyGroup>
53+
<DefaultItemExcludes>$(DefaultItemExcludes);App_Data\**;node_modules\**</DefaultItemExcludes>
54+
</PropertyGroup>
55+
56+
<Target Name="CreateWwwrootFolderBuild" AfterTargets="AfterBuild">
57+
<MakeDir Directories="$(BuildDir)wwwroot" Condition="!Exists('$(BuildDir)wwwroot')" />
58+
</Target>
59+
60+
<Target Name="CreateAppDataFolder" BeforeTargets="Publish">
61+
<MakeDir Directories="$(PublishDir)App_Data" Condition="!Exists('$(PublishDir)App_Data')" />
62+
<Exec Command="npm install" />
63+
<Exec Command="npm run ui:build" />
64+
<RemoveDir Directories="$(PublishDir)wwwroot" />
5265
<ItemGroup>
53-
<Folder Include="App_Data\" />
66+
<CopyDist Include="./wwwroot/**/*.*" />
5467
</ItemGroup>
55-
56-
<Target Name="tailwind" BeforeTargets="Publish">
57-
<Exec Command="npm run ui:build" WorkingDirectory="./" />
58-
</Target>
68+
<Copy SourceFiles="@(CopyDist)" DestinationFiles="@(CopyDist->'$(PublishDir)wwwroot\%(RecursiveDir)%(Filename)%(Extension)')" />
69+
</Target>
5970

6071
</Project>

MyApp/_posts/2023-11-28_net8-identity-auth.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ but replace their internal implementation to use ASP.NET Identity Auth instead.
120120
The new Identity Auth integration is contained in the .NET 6+ **ServiceStack.Extensions** NuGet package:
121121

122122
```xml
123-
<PackageReference Include="ServiceStack.Extensions" Version="8.*" />
123+
<PackageReference Include="ServiceStack.Extensions" Version="10.*" />
124124
```
125125

126126
Which at a minimum lets you configure ServiceStack to use Identity Auth by simply registering the existing `AuthFeature`

MyApp/_posts/2024-02-08_openapi-v3.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ x mix openapi3
7575
This will install the required ASP.NET Core Microsoft, Swashbuckle and ServiceStack Open API NuGet packages:
7676

7777
```xml
78-
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.*" />
79-
<PackageReference Include="Swashbuckle.AspNetCore" Version="8.*" />
80-
<PackageReference Include="ServiceStack.AspNetCore.OpenApi" Version="8.*" />
78+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.*" />
79+
<PackageReference Include="Swashbuckle.AspNetCore" Version="10.*" />
80+
<PackageReference Include="ServiceStack.AspNetCore.OpenApi" Version="10.*" />
8181
```
8282

8383
Then add the `Configure.OpenApi.cs` [Modular Startup](https://docs.servicestack.net/modular-startup) class to your project:

MyApp/_posts/2024-02-11_jwt-identity-auth.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public class ConfigureAuth : IHostingStartup
6060
Once configured we can enable JWT Auth in Swagger UI by installing **Swashbuckle.AspNetCore**:
6161

6262
:::copy
63-
`<PackageReference Include="Swashbuckle.AspNetCore" Version="8.*" />`
63+
`<PackageReference Include="Swashbuckle.AspNetCore" Version="10.*" />`
6464
:::
6565

6666
Then enable Open API, Swagger UI, ServiceStack's support for Swagger UI and the JWT Bearer Auth option:

MyApp/_posts/2024-03-01_vite-press-plugin.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,14 +453,14 @@ HTML or XML fragments can also be copied by escaping them first:
453453

454454
```md
455455
:::copy
456-
`<PackageReference Include="ServiceStack" Version="8.*" />`
456+
`<PackageReference Include="ServiceStack" Version="10.*" />`
457457
:::
458458
```
459459

460460
#### Output
461461

462462
:::copy
463-
`<PackageReference Include="ServiceStack" Version="8.*" />`
463+
`<PackageReference Include="ServiceStack" Version="10.*" />`
464464
:::
465465

466466
### sh

0 commit comments

Comments
 (0)