Skip to content

Commit 26f95cd

Browse files
committed
* fix designer build error
* add docker file for host * add github action file
1 parent 6c1d797 commit 26f95cd

File tree

14 files changed

+198
-35
lines changed

14 files changed

+198
-35
lines changed

.github/workflows/build.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: build and pack
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-18.04
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
18+
- uses: actions/cache@v3
19+
with:
20+
path: ${{github.workspace}}/src/Passingwind.ElsaDesigner/node_modules
21+
key: ${{ runner.os }}-yarn-cache
22+
restore-keys: |
23+
${{ runner.os }}-node-
24+
25+
- name: Setup .NET
26+
uses: actions/setup-dotnet@v1
27+
with:
28+
dotnet-version: 5.0.x
29+
30+
- name: Install Dotnet Tool
31+
run: dotnet tool install -g Passingwind.Git-CI-Tools
32+
33+
- name: Set environment variables
34+
uses: rlespinasse/[email protected]
35+
36+
- name: Version check and generate
37+
run: |
38+
gitci release changes --output ./changeslog.md
39+
gitci version next --format json --output ./version.json --build-ver "${{env.GITHUB_SHA_SHORT}}"
40+
ls ./
41+
42+
- name: Setup .NET
43+
uses: actions/setup-dotnet@v1
44+
with:
45+
dotnet-version: 6.0.x
46+
47+
- name: Restore dependencies
48+
run: dotnet restore
49+
50+
- name: Build
51+
run: dotnet build --no-restore -c Release
52+
53+
- name: Pack
54+
run: dotnet pack --no-build --no-restore -c Release /p:Version="${{env.GITCI_NEXT_VERSION}}" -o ./pack_output
55+
56+
- uses: actions/setup-node@v3
57+
with:
58+
node-version: "16"
59+
- name: yarn
60+
run: |
61+
cd ./src/Passingwind.ElsaDesigner
62+
yarn
63+
- name: npm build
64+
run: |
65+
cd ./src/Passingwind.ElsaDesigner
66+
npm run build
67+
- name: copy build out
68+
run: |
69+
cd ${{github.workspace}}/src/Passingwind.ElsaDesigner
70+
zip ${{github.workspace}}/pack_output/designer.zip -r ./dist/*
71+
72+
- name: Push package
73+
run: dotnet nuget push ./pack_output/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TOKEN}} --source https://api.nuget.org/v3/index.json
74+
75+
- name: Create Release
76+
uses: ncipollo/release-action@v1
77+
with:
78+
tag: v${{env.GITCI_NEXT_VERSION}}
79+
artifacts: ./changeslog*, ./pack_output/*
80+
bodyFile: ./changeslog.md
81+
prerelease: false
82+
token: ${{ secrets.GITHUB_TOKEN }}

Passingwind.Abp.ElsaModule.sln

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Passingwind.Abp.ElsaModule.
3131
EndProject
3232
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Passingwind.Abp.ElsaModule.Installer", "src\Passingwind.Abp.ElsaModule.Installer\Passingwind.Abp.ElsaModule.Installer.csproj", "{BE39FD00-745B-4049-8161-FC129817CBE4}"
3333
EndProject
34-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ElsaDemo", "host\ElsaDemo\ElsaDemo.csproj", "{5C0D50CD-619A-41C7-9761-5929EED5F22F}"
35-
EndProject
3634
Global
3735
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3836
Debug|Any CPU = Debug|Any CPU
@@ -87,10 +85,6 @@ Global
8785
{BE39FD00-745B-4049-8161-FC129817CBE4}.Debug|Any CPU.Build.0 = Debug|Any CPU
8886
{BE39FD00-745B-4049-8161-FC129817CBE4}.Release|Any CPU.ActiveCfg = Release|Any CPU
8987
{BE39FD00-745B-4049-8161-FC129817CBE4}.Release|Any CPU.Build.0 = Release|Any CPU
90-
{5C0D50CD-619A-41C7-9761-5929EED5F22F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
91-
{5C0D50CD-619A-41C7-9761-5929EED5F22F}.Debug|Any CPU.Build.0 = Debug|Any CPU
92-
{5C0D50CD-619A-41C7-9761-5929EED5F22F}.Release|Any CPU.ActiveCfg = Release|Any CPU
93-
{5C0D50CD-619A-41C7-9761-5929EED5F22F}.Release|Any CPU.Build.0 = Release|Any CPU
9488
EndGlobalSection
9589
GlobalSection(SolutionProperties) = preSolution
9690
HideSolutionNode = FALSE
@@ -108,7 +102,6 @@ Global
108102
{690203F4-3CD5-4569-88D9-EE831EEA5F5F} = {E400416D-2895-4512-9D17-90681EEC7E0A}
109103
{F6AC8D4A-EDD7-4514-8E8A-5BCB019864DB} = {E400416D-2895-4512-9D17-90681EEC7E0A}
110104
{BE39FD00-745B-4049-8161-FC129817CBE4} = {649A3FFA-182F-4E56-9717-E6A9A2BEC545}
111-
{5C0D50CD-619A-41C7-9761-5929EED5F22F} = {E400416D-2895-4512-9D17-90681EEC7E0A}
112105
EndGlobalSection
113106
GlobalSection(ExtensibilityGlobals) = postSolution
114107
SolutionGuid = {4324B3B4-B60B-4E3C-91D8-59576B4E26DD}

host/Passingwind.Abp.ElsaModule.Host.Shared/Passingwind.Abp.ElsaModule.Host.Shared.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<PropertyGroup>
66
<TargetFramework>netstandard2.0</TargetFramework>
77
<RootNamespace>Passingwind.Abp.ElsaModule</RootNamespace>
8+
<IsPackable>false</IsPackable>
89
</PropertyGroup>
910

1011
</Project>

host/Passingwind.Abp.ElsaModule.HttpApi.Host/ElsaModuleHttpApiHostModule.cs

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.IO;
44
using System.Linq;
5+
using System.Threading.Tasks;
56
using Elsa;
67
using Elsa.Activities.UserTask.Extensions;
78
using Hangfire;
@@ -10,6 +11,7 @@
1011
using Microsoft.AspNetCore.Builder;
1112
using Microsoft.AspNetCore.Cors;
1213
using Microsoft.AspNetCore.DataProtection;
14+
using Microsoft.AspNetCore.HttpOverrides;
1315
using Microsoft.AspNetCore.Mvc;
1416
using Microsoft.Extensions.DependencyInjection;
1517
using Microsoft.Extensions.Hosting;
@@ -265,13 +267,24 @@ public override void ConfigureServices(ServiceConfigurationContext context)
265267
options.AutoValidate = false;
266268
});
267269

270+
context.Services.AddSpaStaticFiles(options =>
271+
{
272+
options.RootPath = "wwwroot/dist";
273+
});
274+
268275
}
269276

270277
public override void OnApplicationInitialization(ApplicationInitializationContext context)
271278
{
272279
var app = context.GetApplicationBuilder();
273280
var env = context.GetEnvironment();
274281

282+
app.UseForwardedHeaders(new ForwardedHeadersOptions
283+
{
284+
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto,
285+
ForwardLimit = null,
286+
});
287+
275288
if (env.IsDevelopment())
276289
{
277290
app.UseDeveloperExceptionPage();
@@ -281,22 +294,24 @@ public override void OnApplicationInitialization(ApplicationInitializationContex
281294
app.UseHsts();
282295
}
283296

284-
app.UseHttpsRedirection();
297+
// app.UseHttpsRedirection();
285298
app.UseCorrelationId();
286299
app.UseStaticFiles();
287-
288-
app.UseHttpActivities();
300+
app.UseSpaStaticFiles();
289301

290302
app.UseRouting();
291303
app.UseCors();
304+
305+
app.UseHttpActivities();
306+
292307
app.UseAuthentication();
293308
if (MultiTenancyConsts.IsEnabled)
294309
{
295310
app.UseMultiTenancy();
296311
}
297-
app.UseHangfireDashboard();
298-
299312

313+
app.UseHangfireDashboard();
314+
300315
app.UseAbpRequestLocalization();
301316
app.UseAuthorization();
302317
app.UseSwagger();
@@ -314,6 +329,21 @@ public override void OnApplicationInitialization(ApplicationInitializationContex
314329
app.UseAuditing();
315330
app.UseAbpSerilogEnrichers();
316331
app.UseConfiguredEndpoints();
332+
333+
app.Use((context, next) =>
334+
{
335+
if (context.Request.Path.StartsWithSegments("/api"))
336+
{
337+
context.Response.StatusCode = 404;
338+
return Task.CompletedTask;
339+
}
340+
341+
return next();
342+
});
343+
344+
#if !DEBUG
345+
app.UseSpa(c => { });
346+
#endif
317347
}
318348

319349
public class SwaggerEnumDescriptions : ISchemaFilter

host/Passingwind.Abp.ElsaModule.HttpApi.Host/Passingwind.Abp.ElsaModule.HttpApi.Host.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13+
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="6.0.*" />
1314
<PackageReference Include="Hangfire.MemoryStorage" Version="1.7.0" />
1415
<PackageReference Include="Serilog.AspNetCore" Version="4.1.0" />
1516
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />

host/Passingwind.Abp.ElsaModule.HttpApi.Host/Program.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
using System;
22
using System.Threading.Tasks;
33
using Microsoft.AspNetCore.Builder;
4+
using Microsoft.EntityFrameworkCore;
45
using Microsoft.Extensions.DependencyInjection;
56
using Microsoft.Extensions.Hosting;
7+
using Passingwind.Abp.ElsaModule.EntityFrameworkCore;
68
using Serilog;
79
using Serilog.Events;
810

@@ -29,7 +31,16 @@ public async static Task<int> Main(string[] args)
2931
.UseAutofac()
3032
.UseSerilog();
3133
await builder.AddApplicationAsync<ElsaModuleHttpApiHostModule>();
34+
3235
var app = builder.Build();
36+
37+
//using (var scope = app.Services.CreateScope())
38+
//{
39+
// var sp = scope.ServiceProvider;
40+
// var dbcontext = sp.GetRequiredService<ElsaModuleHttpApiHostMigrationsDbContext>();
41+
// await dbcontext.Database.MigrateAsync();
42+
//}
43+
3344
await app.InitializeApplicationAsync();
3445
await app.RunAsync();
3546
return 0;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM mcr.microsoft.com/dotnet/aspnet:6.0-focal as base
2+
3+
# change source
4+
# RUN sed -i "[email protected]@mirrors.aliyun.com@g" /etc/apt/sources.list
5+
6+
#
7+
RUN apt-get update -y && apt-get install -y libgdiplus && apt-get clean
8+
9+
#
10+
RUN sed -i 's/MinProtocol = TLSv1.2/MinProtocol = TLSv1.0/g' /etc/ssl/openssl.cnf
11+
RUN sed -i 's/MinProtocol = TLSv1.2/MinProtocol = TLSv1.0/g' /usr/lib/ssl/openssl.cnf
12+
13+
#
14+
COPY app /app
15+
16+
#
17+
WORKDIR /app
18+
19+
ENTRYPOINT ["dotnet", "Passingwind.Abp.ElsaModule.HttpApi.Host.dll"]
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{
2+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: '3.8'
2+
3+
services:
4+
app:
5+
build: .
6+
# image: backend:latest
7+
ports:
8+
- 10000:80
9+
restart: always
10+
environment:
11+
- TZ=Asia/Shanghai
12+
volumes:
13+
# - ./appsettings.json:/app/appsettings.Production.json
14+
#
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<Import Project="..\..\common.props" />
3+
<Import Project="..\..\common.props" />
44

5-
<PropertyGroup>
6-
<TargetFramework>netstandard2.1</TargetFramework>
7-
<RootNamespace>Passingwind.Abp.ElsaModule</RootNamespace>
8-
</PropertyGroup>
5+
<PropertyGroup>
6+
<TargetFramework>netstandard2.1</TargetFramework>
7+
<RootNamespace>Passingwind.Abp.ElsaModule</RootNamespace>
8+
</PropertyGroup>
99

10-
<ItemGroup>
11-
<PackageReference Include="Volo.Abp.Http.Client" Version="5.1.4" />
12-
<ProjectReference Include="..\Passingwind.Abp.ElsaModule.Application.Contracts\Passingwind.Abp.ElsaModule.Application.Contracts.csproj" />
13-
</ItemGroup>
10+
<ItemGroup>
11+
<PackageReference Include="Volo.Abp.Http.Client" Version="5.1.4" />
12+
<ProjectReference Include="..\Passingwind.Abp.ElsaModule.Application.Contracts\Passingwind.Abp.ElsaModule.Application.Contracts.csproj" />
13+
</ItemGroup>
1414

15-
<ItemGroup>
16-
<EmbeddedResource Include="**\*generate-proxy.json" />
17-
<Content Remove="**\*generate-proxy.json" />
18-
</ItemGroup>
15+
<ItemGroup>
16+
<EmbeddedResource Include="**\*generate-proxy.json" />
17+
<Content Remove="**\*generate-proxy.json" />
18+
</ItemGroup>
1919

2020
</Project>

0 commit comments

Comments
 (0)