Skip to content

Commit 0c7d367

Browse files
committed
⭐ Add nuget package settings and implemented deploy pipeline
1 parent 56d1b3e commit 0c7d367

File tree

4 files changed

+55
-4
lines changed

4 files changed

+55
-4
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ on:
88
- reopened
99
- edited
1010
- synchronize
11-
push:
12-
branches:
13-
- master
1411

1512
jobs:
1613
# Build source code
@@ -36,4 +33,5 @@ jobs:
3633
3734
# Build the project
3835
- name: Build project
36+
if: success()
3937
run: dotnet cake build.cake --target=build

.github/workflows/deploy.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Deploy
2+
on:
3+
pull_request:
4+
types:
5+
- closed
6+
7+
jobs:
8+
# Deploy nuget package when a branch is labeled with `release` and the merge is done to master.
9+
Deploy:
10+
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release') && github.event.pull_request.base.ref == 'master'
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
dotnet-version: [8.0.x]
15+
steps:
16+
- name: Checkout Repository
17+
uses: actions/checkout@v4
18+
19+
# Setup .NET SDK
20+
- name: Set up .NET SDK ${{ matrix.dotnet-version }}
21+
uses: actions/setup-dotnet@v1
22+
with:
23+
dotnet-version: ${{ matrix.dotnet-version }}
24+
25+
# Setup cake tool
26+
- name: Setup cake tool
27+
run: dotnet tool install --global Cake.Tool
28+
29+
# Build the project
30+
- name: Build project
31+
if: success()
32+
run: dotnet cake build.cake --target=build
33+
34+
# Deploy nuget package
35+
- name: Deploy nuget package
36+
if: success()
37+
env:
38+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
39+
run: |
40+
# Extract nuget package version
41+
NUGET_PKG_VERSION=$(cat NETCore.Keycloak.Client/NETCore.Keycloak.Client.csproj | grep "PackageVersion" | awk -F '>' '{print $2}' | awk -F '<' '{print $1}')
42+
dotnet nuget push NETCore.Keycloak.Client/Release/NETCore.Keycloak.Client.${NUGET_PKG_VERSION}.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json
43+

NETCore.Keycloak.Client/NETCore.Keycloak.Client.csproj

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
32
<PropertyGroup>
3+
<Authors>Hasni Mehdi</Authors>
4+
<Description>
5+
A comprehensive .NET Core client library for Keycloak that provides seamless integration with Keycloak's authentication and authorization services.
6+
This library offers a robust implementation of Keycloak's REST API, including support for OpenID Connect, OAuth 2.0, and User-Managed Access (UMA 2.0).
7+
</Description>
8+
<PackageVersion>1.0.0</PackageVersion>
9+
<PackageId>NETCore.Keycloak.Client</PackageId>
10+
<PackageTags>keycloak;oauth2;authentication;authorization;openid-connect;oidc;oidc-provider;fapi;fapi-client;user-managed-access;financial-security</PackageTags>
11+
<PackageIcon>black_cockpit.png</PackageIcon>
412
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
513
<LangVersion>latest</LangVersion>
614
<ImplicitUsings>enable</ImplicitUsings>
715
<Nullable>disable</Nullable>
816
<OutputType>Library</OutputType>
17+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
918
<RootNamespace>NETCore.Keycloak.Client</RootNamespace>
1019
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1120
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
@@ -23,5 +32,6 @@
2332
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.3.0"/>
2433
<PackageReference Include="System.Text.Json" Version="8.0.5"/>
2534
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.33"/>
35+
<None Include="black_cockpit.png" Pack="true" PackagePath="\"/>
2636
</ItemGroup>
2737
</Project>

0 commit comments

Comments
 (0)