Compare commits
12 Commits
BIN
.gitea/readme/icon.png
Normal file
BIN
.gitea/readme/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
32
.gitea/workflows/build.yml
Normal file
32
.gitea/workflows/build.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "dev"
|
||||
paths:
|
||||
- "TimetableDesigner.Backend.Events**"
|
||||
pull_request:
|
||||
branches:
|
||||
- "dev"
|
||||
- "main"
|
||||
paths:
|
||||
- "TimetableDesigner.Backend.Events**"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: linux
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 10.0.x
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
- name: Build
|
||||
run: dotnet build --no-restore
|
||||
- name: Create NuGet package
|
||||
run: dotnet pack -c Debug --output ./
|
||||
96
.gitea/workflows/build_publish.yml
Normal file
96
.gitea/workflows/build_publish.yml
Normal file
@@ -0,0 +1,96 @@
|
||||
name: Build and publish package
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
branches:
|
||||
- "main"
|
||||
push:
|
||||
branches:
|
||||
- "main"
|
||||
paths:
|
||||
- "TimetableDesigner.Backend.Events**"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: linux
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 10.0.x
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore
|
||||
- name: Build
|
||||
run: dotnet build --no-restore
|
||||
version:
|
||||
name: Determine version
|
||||
runs-on: linux
|
||||
needs: build
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: 10.0.x
|
||||
- name: Setup GitVersion
|
||||
uses: gittools/actions/gitversion/setup@v4.2.0
|
||||
with:
|
||||
versionSpec: 6.4.x
|
||||
- name: Determine version
|
||||
uses: gittools/actions/gitversion/execute@v4.2.0
|
||||
id: gitversion
|
||||
with:
|
||||
configFilePath: ./.gitea/config/gitversion.yml
|
||||
outputs:
|
||||
version: ${{ steps.gitversion.outputs.SemVer }}
|
||||
pack:
|
||||
name: Pack
|
||||
runs-on: linux
|
||||
needs: version
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: 10.0.x
|
||||
- name: Create NuGet package
|
||||
run: dotnet pack -c Release -p:Version=${{needs.version.outputs.version}} -p:PackageVersion=${{needs.version.outputs.version}} --output ./
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: nuget
|
||||
path: ./TimetableDesigner.Backend.Events.${{needs.version.outputs.version}}.nupkg
|
||||
outputs:
|
||||
version: ${{needs.version.outputs.version}}
|
||||
publish:
|
||||
name: Publish
|
||||
runs-on: linux
|
||||
needs: pack
|
||||
steps:
|
||||
- name: Download artifact
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: nuget
|
||||
path: ./
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: 10.0.x
|
||||
- name: Add package source
|
||||
run: dotnet nuget add source --name gitea --username TimetableDesigner --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text https://repos.mateuszskoczek.com/api/packages/TimetableDesigner/nuget/index.json
|
||||
- name: Publish
|
||||
run: dotnet nuget push ./TimetableDesigner.Backend.Events.${{needs.pack.outputs.version}}.nupkg --source gitea --api-key ${{ secrets.PACKAGES_WRITE_TOKEN }} --skip-duplicate
|
||||
- name: Create Release
|
||||
uses: akkuman/gitea-release-action@v1
|
||||
with:
|
||||
tag_name: ${{needs.pack.outputs.version}}
|
||||
name: ${{needs.pack.outputs.version}}
|
||||
files: |-
|
||||
TimetableDesigner.Backend.Events.${{needs.pack.outputs.version}}.nupkg
|
||||
22
.github/workflows/pull_request_dev.yml
vendored
22
.github/workflows/pull_request_dev.yml
vendored
@@ -1,22 +0,0 @@
|
||||
name: Build NuGet package on dev branch pull request
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- "dev"
|
||||
paths:
|
||||
- "TimetableDesigner.Backend.Events**"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6.0.2
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: 10.0.x
|
||||
- name: Build
|
||||
run: dotnet build
|
||||
22
.github/workflows/pull_request_main.yml
vendored
22
.github/workflows/pull_request_main.yml
vendored
@@ -1,22 +0,0 @@
|
||||
name: Build NuGet package on main branch pull request
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- "main"
|
||||
paths:
|
||||
- "TimetableDesigner.Backend.Events**"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6.0.2
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: 10.0.x
|
||||
- name: Build
|
||||
run: dotnet build
|
||||
22
.github/workflows/push_dev.yml
vendored
22
.github/workflows/push_dev.yml
vendored
@@ -1,22 +0,0 @@
|
||||
name: Build NuGet package on dev branch push
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "dev"
|
||||
paths:
|
||||
- "TimetableDesigner.Backend.Events**"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6.0.2
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: 10.0.x
|
||||
- name: Build
|
||||
run: dotnet build
|
||||
72
.github/workflows/push_main.yml
vendored
72
.github/workflows/push_main.yml
vendored
@@ -1,72 +0,0 @@
|
||||
name: Build NuGet package on main branch push
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "main"
|
||||
paths:
|
||||
- "TimetableDesigner.Backend.Events**"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build and pack
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6.0.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: 10.0.x
|
||||
- name: Build
|
||||
run: dotnet build
|
||||
- name: Setup GitVersion
|
||||
uses: gittools/actions/gitversion/setup@v4.2.0
|
||||
with:
|
||||
versionSpec: 6.4.x
|
||||
- name: Determine version
|
||||
uses: gittools/actions/gitversion/execute@v4.2.0
|
||||
id: gitversion
|
||||
with:
|
||||
configFilePath: ./.github/config/gitversion.yml
|
||||
- name: Create NuGet package
|
||||
run: dotnet pack -c Release -p:Version=${{steps.gitversion.outputs.SemVer}} -p:PackageVersion=${{steps.gitversion.outputs.SemVer}} --output ${{ github.workspace}}/nuget
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: nuget
|
||||
path: ${{ github.workspace}}/nuget/*.nupkg
|
||||
outputs:
|
||||
version: ${{ steps.gitversion.outputs.SemVer }}
|
||||
publish:
|
||||
name: Publish
|
||||
permissions: write-all
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- name: Download artifact
|
||||
uses: actions/download-artifact@v6
|
||||
with:
|
||||
name: nuget
|
||||
path: ${{ github.workspace}}/nuget
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: 10.0.x
|
||||
- name: Add source
|
||||
run: dotnet nuget add source --username TimetableDesigner --password ${{secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/TimetableDesigner/index.json"
|
||||
- name: Publish
|
||||
run: dotnet nuget push ${{ github.workspace}}/nuget/*.nupkg --source "github" --api-key ${{ secrets.NUGET_REGISTRY_API_KEY }} --skip-duplicate
|
||||
- name: Create Release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{needs.build.outputs.version}}
|
||||
release_name: ${{needs.build.outputs.version}}
|
||||
draft: false
|
||||
prerelease: false
|
||||
|
||||
|
||||
@@ -4,8 +4,14 @@ namespace TimetableDesigner.Backend.Events;
|
||||
|
||||
public abstract class EventQueue<TSelf> where TSelf : EventQueue<TSelf>
|
||||
{
|
||||
public abstract void Setup<TBuilder>(IServiceCollection services, TBuilder configuration)
|
||||
where TBuilder : EventQueueBuilder<TSelf>;
|
||||
|
||||
public abstract void Setup(IServiceCollection services, string connectionString);
|
||||
public void Setup<TBuilder>(IServiceCollection services, TBuilder configuration)
|
||||
where TBuilder : EventQueueBuilder<TSelf> =>
|
||||
Setup(services, configuration.GetConnectionParameters());
|
||||
|
||||
public void Setup(IServiceCollection services, string connectionString)
|
||||
=> Setup(services, connectionString.Split(';')
|
||||
.Select(x => x.Split('='))
|
||||
.ToDictionary(x => x.First(), x => x.Last()));
|
||||
|
||||
protected abstract void Setup(IServiceCollection services, IDictionary<string, string> connectionParameters);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
namespace TimetableDesigner.Backend.Events;
|
||||
|
||||
public abstract class EventQueueBuilder<TQueue> where TQueue : EventQueue<TQueue>;
|
||||
public abstract class EventQueueBuilder<TQueue> where TQueue : EventQueue<TQueue>
|
||||
{
|
||||
public abstract IDictionary<string, string> GetConnectionParameters();
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
namespace TimetableDesigner.Backend.Events;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Nodes;
|
||||
|
||||
namespace TimetableDesigner.Backend.Events;
|
||||
|
||||
public interface IEventQueuePublisher
|
||||
{
|
||||
public Task PublishAsync<T>(T data) where T : class;
|
||||
public sealed Task PublishAsync<T>(T data) where T : class => PublishAsync(JsonSerializer.Serialize(data), data.GetType());
|
||||
public Task PublishAsync(string data, Type dataType);
|
||||
}
|
||||
Reference in New Issue
Block a user