diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..e4e9ff5
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,28 @@
+# This workflow will build a .NET project
+# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
+
+name: Build
+
+on:
+ push:
+ branches: [ "main" ]
+ pull_request:
+ branches: [ "main" ]
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v4
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: 8.0.x
+ - name: Restore dependencies
+ run: dotnet restore
+ - name: Build
+ run: dotnet build --no-restore
+ - name: Test
+ run: dotnet test --no-build --verbosity normal
diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml
new file mode 100644
index 0000000..7044e9c
--- /dev/null
+++ b/.github/workflows/cd.yml
@@ -0,0 +1,32 @@
+name: Publish
+
+on:
+ release:
+ types: [published]
+
+jobs:
+ release:
+ name: Release
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Setup dotnet
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: 8.0.x
+
+ - name: Install dependencies
+ run: dotnet restore
+ - name: Build
+ run: dotnet build --configuration Release --no-restore
+ - name: Pack
+ run: dotnet pack --configuration Release --no-restore
+ - name: Publish
+ uses: softprops/action-gh-release@v2.0.8
+ with:
+ files: |
+ /home/runner/work/Cosmos.Threading/Cosmos.Threading/bin/Debug/Cosmos.Threading*.nupkg
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/Cosmos.Threading/Cosmos.Threading.csproj b/Cosmos.Threading/Cosmos.Threading.csproj
index b978727..3f59514 100644
--- a/Cosmos.Threading/Cosmos.Threading.csproj
+++ b/Cosmos.Threading/Cosmos.Threading.csproj
@@ -22,9 +22,10 @@
-
-
-
+
+
+
+
diff --git a/README.md b/README.md
index d9ef78a..ba8e753 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,8 @@
# Cosmos.Threading
-[![Build Status](https://derekgn.visualstudio.com/GitHub/_apis/build/status%2FDerekGn.Cosmos.Threading?branchName=main)](https://derekgn.visualstudio.com/GitHub/_build/latest?definitionId=14&branchName=main)
+![GitHub Actions](https://github.com/DerekGn/Cosmos.Threading/actions/workflows/build.yml/badge.svg)
-[![NuGet Badge](https://buildstats.info/nuget/Cosmos.Threading)](https://www.nuget.org/packages/Cosmos.Threading/)
+[![NuGet](https://img.shields.io/nuget/v/Cosmos.Threading.svg?style=flat-square)](https://www.nuget.org/packages/Cosmos.Threading/)
A library that contains a simple cosmos based distributed mutex. The mutex allows processes to coordinate access to a shared set of resources.
diff --git a/TestConsole/Program.cs b/TestConsole/Program.cs
index f923d66..b07874a 100644
--- a/TestConsole/Program.cs
+++ b/TestConsole/Program.cs
@@ -31,7 +31,7 @@
namespace TestConsole
{
- internal class Program
+ internal static class Program
{
private static CosmosClient CreateCosmosClient(string connectionString)
{
@@ -65,7 +65,7 @@ private static async Task Main(string[] args)
services
.AddLogging(builder => builder.AddSerilog())
.AddLogging()
- .AddSingleton(CreateCosmosClient(configuration["Cosmos:ConnectionString"]))
+ .AddSingleton(CreateCosmosClient(configuration["Cosmos:ConnectionString"]!))
.AddSingleton()
.AddSingleton()
.AddSingleton();
diff --git a/TestConsole/TestConsole.csproj b/TestConsole/TestConsole.csproj
index 1ae635f..fe865a2 100644
--- a/TestConsole/TestConsole.csproj
+++ b/TestConsole/TestConsole.csproj
@@ -8,18 +8,19 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
deleted file mode 100644
index 8a0d0ef..0000000
--- a/azure-pipelines.yml
+++ /dev/null
@@ -1,45 +0,0 @@
-variables:
-- name: BuildParameters.solution
- value: '**\*.sln'
-
-name: $(Major).$(Minor).$(Patch).$(Build)
-
-trigger:
-- main
-
-pool:
- vmImage: windows-latest
-
-steps:
- - task: DotNetCoreCLI@2
- displayName: "Build Solution"
- inputs:
- command: 'build'
- projects: $(BuildParameters.solution)
- arguments: /p:Configuration=$(BuildConfiguration)
-# Workaraound for the pack command not accepting arguments
-# https://github.com/microsoft/azure-pipelines-tasks/issues/11640
- - task: DotNetCoreCLI@2
- displayName: Pack
- inputs:
- command: custom
- custom: pack
- arguments: >
- Cosmos.Threading.sln
- --output $(Build.ArtifactStagingDirectory)
- -p:PackageVersion=$(PackageVersion)
- -p:Configuration=$(BuildConfiguration)
- -p:Version=$(PackageVersion)
- -p:AssemblyVersion=$(Build.BuildNumber)
- - task: GitHubRelease@1
- displayName: "Publish Relase To GitHub"
- inputs:
- gitHubConnection: 'GitHub PAT'
- repositoryName: '$(Build.Repository.Name)'
- action: 'create'
- target: '$(Build.SourceVersion)'
- tagSource: 'userSpecifiedTag'
- tag: 'v$(Build.BuildNumber)'
- title: 'v$(Build.BuildNumber) - $(BuildConfiguration) - $(Build.SourceBranchName)'
- changeLogCompareToRelease: 'lastFullRelease'
- changeLogType: 'commitBased'
\ No newline at end of file