Skip to content

Commit a8d1cf4

Browse files
committed
Upgrade to .NET 10
1 parent f3ed4bc commit a8d1cf4

File tree

17 files changed

+157
-121
lines changed

17 files changed

+157
-121
lines changed

.github/workflows/build.yml

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

34
on:
@@ -16,10 +17,26 @@ jobs:
1617
- name: Setup dotnet
1718
uses: actions/setup-dotnet@v5
1819
with:
19-
dotnet-version: 8.0.x
20+
dotnet-version: 10.0.x
21+
22+
- name: Restore NuGet packages (use repo NuGet.config)
23+
run: dotnet restore MyApp.slnx --configfile ./NuGet.Config
24+
25+
# If your feed requires authentication, enable and configure the step below.
26+
# This example uses a Personal Access Token stored in secrets.NUGET_API_KEY.
27+
# Alternatively, you can use the NuGet Authenticate action from Azure Pipelines.
28+
# - name: Authenticate private NuGet feed
29+
# env:
30+
# NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
31+
# run: |
32+
# dotnet nuget add source "https://YOUR_FEED_URL/index.json" \
33+
# --name "PrivateFeed" \
34+
# --username "YOUR_USERNAME" \
35+
# --password "$NUGET_API_KEY" \
36+
# --store-password-in-clear-text
2037

2138
- name: build
22-
run: dotnet build
39+
run: dotnet build --no-restore
2340
working-directory: .
2441

2542
- name: test

.github/workflows/release.yml

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ on:
1414

1515
env:
1616
DOCKER_BUILDKIT: 1
17-
KAMAL_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
18-
KAMAL_REGISTRY_USERNAME: ${{ github.actor }}
1917
SERVICESTACK_LICENSE: ${{ secrets.SERVICESTACK_LICENSE }}
18+
KAMAL_DEPLOY_IP: ${{ secrets.KAMAL_DEPLOY_IP }}
19+
KAMAL_DEPLOY_HOST: ${{ secrets.KAMAL_DEPLOY_HOST }}
20+
KAMAL_REGISTRY_USERNAME: ${{ github.actor }}
21+
KAMAL_REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
2022

2123
jobs:
2224
release:
@@ -38,24 +40,12 @@ jobs:
3840
echo "HAS_MIGRATIONS=false" >> $GITHUB_ENV
3941
fi
4042
41-
# This step is for the deployment of the templates only, safe to delete
42-
- name: Modify deploy.yml
43-
env:
44-
KAMAL_DEPLOY_IP: ${{ secrets.KAMAL_DEPLOY_IP }}
45-
if: env.KAMAL_DEPLOY_IP != null
46-
run: |
47-
sed -i "s/service: my-app/service: ${{ env.repository_name_lower }}/g" config/deploy.yml
48-
sed -i "s#image: my-user/myapp#image: ${{ env.image_repository_name }}#g" config/deploy.yml
49-
sed -i "s/- 192.168.0.1/- ${{ secrets.KAMAL_DEPLOY_IP }}/g" config/deploy.yml
50-
sed -i "s/host: my-app.example.com/host: ${{ secrets.KAMAL_DEPLOY_HOST }}/g" config/deploy.yml
51-
sed -i "s/MyApp/${{ env.repository_name }}/g" config/deploy.yml
52-
5343
- name: Login to GitHub Container Registry
5444
uses: docker/login-action@v3
5545
with:
5646
registry: ghcr.io
57-
username: ${{ env.KAMAL_REGISTRY_USERNAME }}
58-
password: ${{ env.KAMAL_REGISTRY_PASSWORD }}
47+
username: ${{ github.actor }}
48+
password: ${{ secrets.GITHUB_TOKEN }}
5949

6050
- name: Set up SSH key
6151
uses: webfactory/[email protected]
@@ -80,29 +70,47 @@ jobs:
8070
run: |
8171
kamal server bootstrap
8272
73+
- name: Ensure directories exist with correct permissions
74+
run: |
75+
echo "Creating directories with correct permissions"
76+
kamal server exec "mkdir -p /opt/docker/${{ env.repository_name }}/App_Data /opt/docker/${{ env.repository_name }}/initdb.d"
77+
78+
echo "Setting app file permissions"
79+
kamal server exec "chown -R 1654:1654 /opt/docker/${{ env.repository_name }}/App_Data /opt/docker/${{ env.repository_name }}/initdb.d"
80+
8381
- name: Check if first run and execute kamal app boot if necessary
8482
run: |
85-
FIRST_RUN_FILE=".${{ env.repository_name }}"
86-
if ! kamal server exec --no-interactive -q "test -f $FIRST_RUN_FILE"; then
87-
kamal server exec --no-interactive -q "touch $FIRST_RUN_FILE" || true
83+
FIRST_RUN_FILE="~/first-run/${{ env.repository_name }}"
84+
if ! kamal server exec -q "test -f $FIRST_RUN_FILE"; then
85+
kamal server exec -q "mkdir -p ~/first-run && touch $FIRST_RUN_FILE" || true
86+
87+
if [ -n "${{env.INIT_DB_SQL}}" ]; then
88+
echo "Initializing DB with INIT_DB_SQL secret..."
89+
# Save the SQL content to a temporary file
90+
echo "${{ env.INIT_DB_SQL }}" > init-db.sql
91+
cat init-db.sql | kamal server exec -i "cat > /opt/docker/${{ env.repository_name }}/initdb.d/${{ env.repository_name }}.sql" && rm init-db.sql || true
92+
fi
93+
# Start all kamal accessories
94+
kamal accessory boot all || true
95+
96+
# Deploy latest version
8897
kamal deploy -q -P --version latest || true
8998
else
9099
echo "Not first run, skipping kamal app boot"
91-
fi
100+
fi
92101
93-
- name: Ensure file permissions
102+
- name: Verify file permissions before deploy
103+
run: |
104+
kamal server exec --no-interactive "chown -R 1654:1654 /opt/docker/${{ env.repository_name }}/App_Data /opt/docker/${{ env.repository_name }}/initdb.d"
105+
106+
- name: Deploy with Kamal
94107
run: |
95-
kamal server exec --no-interactive "mkdir -p /opt/docker/${{ env.repository_name }}/App_Data && chown -R 1654:1654 /opt/docker/${{ env.repository_name }}"
108+
kamal lock release -v
109+
kamal server exec --no-interactive 'echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin'
110+
kamal server exec --no-interactive 'docker pull ghcr.io/${{ env.image_repository_name }}:latest'
111+
kamal deploy -P --version latest
96112
97113
- name: Migration
98114
if: env.HAS_MIGRATIONS == 'true'
99115
run: |
100-
kamal server exec --no-interactive 'echo "${{ env.KAMAL_REGISTRY_PASSWORD }}" | docker login ghcr.io -u ${{ env.KAMAL_REGISTRY_USERNAME }} --password-stdin'
101-
kamal server exec --no-interactive "docker pull ghcr.io/${{ env.image_repository_name }}:latest || true"
102116
kamal app exec --no-reuse --no-interactive --version=latest "--AppTasks=migrate"
103-
104-
- name: Deploy with Kamal
105-
run: |
106-
kamal lock release -v
107-
kamal server exec --no-interactive 'echo "${{ env.KAMAL_REGISTRY_PASSWORD }}" | docker login ghcr.io -u ${{ env.KAMAL_REGISTRY_USERNAME }} --password-stdin'
108-
kamal deploy -P --version latest

.gitignore

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

66
# Custom
77
dist/
8+
App_Data/
89

910
# User-specific files
1011
*.suo

MyApp.ServiceInterface/MyApp.ServiceInterface.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
</PropertyGroup>
88

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

1313
<ItemGroup>

MyApp.ServiceModel/MyApp.ServiceModel.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
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: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<DebugType>portable</DebugType>
66
<OutputType>Library</OutputType>
77
<Nullable>enable</Nullable>
@@ -12,11 +12,11 @@
1212
<ProjectReference Include="..\MyApp.ServiceInterface\MyApp.ServiceInterface.csproj" />
1313
<ProjectReference Include="..\MyApp.ServiceModel\MyApp.ServiceModel.csproj" />
1414

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

2222
</Project>

MyApp.sln

Lines changed: 0 additions & 43 deletions
This file was deleted.

MyApp.slnx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<Solution>
2+
<Project Path="MyApp.ServiceInterface/MyApp.ServiceInterface.csproj" />
3+
<Project Path="MyApp.ServiceModel/MyApp.ServiceModel.csproj" />
4+
<Project Path="MyApp.Tests/MyApp.Tests.csproj" />
5+
<Project Path="MyApp/MyApp.csproj" />
6+
</Solution>

MyApp/App_Data/.gitkeep

Whitespace-only changes.

MyApp/App_Data/README.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)