Skip to content

Commit 1898e31

Browse files
committed
Updating actions
* Target .net 8 * Include TS build Nuget pack Include licence Versioning nuget publish Fix warnings * missing awaits in test code Typescript build & publish update package json Update webpack config output as module Set version number to 0.0.1 To be set by CI
1 parent 853c680 commit 1898e31

File tree

8 files changed

+175
-16
lines changed

8 files changed

+175
-16
lines changed

.github/workflows/dotnet.yml

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,47 @@ jobs:
1717

1818
steps:
1919
- uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
- name: Get version from git tag
23+
id: version
24+
run: |
25+
VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.1-preview")
26+
VERSION=${VERSION#v}
27+
echo "version=$VERSION" >> $GITHUB_OUTPUT
2028
- name: Setup .NET
2129
uses: actions/setup-dotnet@v4
2230
with:
23-
dotnet-version: 10.0.x
31+
dotnet-version: 8.0.x
2432
- name: Restore dependencies
2533
run: dotnet restore src/CSharp/Rsk.AuthZen.sln
2634
- name: Build
27-
run: dotnet build src/CSharp/Rsk.AuthZen.sln --no-restore
35+
run: dotnet build src/CSharp/Rsk.AuthZen.sln --no-restore --configuration Release
2836
- name: Test
29-
run: dotnet test src/CSharp/Rsk.AuthZen.sln --no-build --verbosity normal
37+
run: dotnet test src/CSharp/Rsk.AuthZen.sln --no-build --verbosity normal --configuration Release
38+
- name: Pack NuGet Package
39+
run: dotnet pack src/CSharp/Rsk.AuthZen.Client/Rsk.AuthZen.Client.csproj --configuration Release --no-build --output ./nupkgs -p:Version=${{ steps.version.outputs.version }}
40+
- name: Upload NuGet Package
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: nuget-package
44+
path: ./nupkgs/*.nupkg
45+
46+
deploy:
47+
runs-on: ubuntu-latest
48+
needs: build
49+
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
50+
environment: nuget-production
51+
52+
steps:
53+
- name: Download NuGet Package
54+
uses: actions/download-artifact@v4
55+
with:
56+
name: nuget-package
57+
path: ./nupkgs
58+
- name: Setup .NET
59+
uses: actions/setup-dotnet@v4
60+
with:
61+
dotnet-version: 8.0.x
62+
- name: Push to NuGet.org
63+
run: dotnet nuget push ./nupkgs/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate

.github/workflows/typescript.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# This workflow will build and test the TypeScript library
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
3+
4+
name: TypeScript
5+
6+
on:
7+
workflow_dispatch: # Manual trigger
8+
push:
9+
branches: [ "main" ]
10+
pull_request:
11+
branches: [ "main" ]
12+
13+
jobs:
14+
build:
15+
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
- name: Get version from git tag
23+
id: version
24+
run: |
25+
VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.1-preview")
26+
VERSION=${VERSION#v}
27+
echo "version=$VERSION" >> $GITHUB_OUTPUT
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: '20'
32+
cache: 'npm'
33+
cache-dependency-path: src/Typescript/package-lock.json
34+
- name: Install dependencies
35+
run: npm ci
36+
working-directory: src/Typescript
37+
- name: Set package version
38+
run: npm version ${{ steps.version.outputs.version }} --no-git-tag-version --allow-same-version
39+
working-directory: src/Typescript
40+
- name: Build
41+
run: npm run build
42+
working-directory: src/Typescript
43+
- name: Test
44+
run: npm test
45+
working-directory: src/Typescript
46+
- name: Pack npm package
47+
run: npm pack
48+
working-directory: src/Typescript
49+
- name: Upload npm package
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: npm-package
53+
path: src/Typescript/*.tgz
54+
55+
deploy:
56+
runs-on: ubuntu-latest
57+
needs: build
58+
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
59+
environment: npm-production
60+
61+
steps:
62+
- name: Download npm package
63+
uses: actions/download-artifact@v4
64+
with:
65+
name: npm-package
66+
path: ./package
67+
- name: Setup Node.js
68+
uses: actions/setup-node@v4
69+
with:
70+
node-version: '20'
71+
registry-url: 'https://registry.npmjs.org'
72+
- name: Publish to npm
73+
run: npm publish ./package/*.tgz --access public
74+
env:
75+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

icon.png

5.89 KB
Loading

src/CSharp/Rsk.AuthZen.Client.Test/AuthZenClientTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2560,7 +2560,7 @@ public async Task Evaluation_On404AfterRecheckingMetadata_ShouldThrowAuthZenRequ
25602560
await sut.Evaluate(evaluationRequest);
25612561
var act = async () => await sut.Evaluate(evaluationRequest);
25622562

2563-
act.Should().ThrowAsync<AuthZenRequestFailureException>();
2563+
await act.Should().ThrowAsync<AuthZenRequestFailureException>();
25642564

25652565
calls.Should().Be(5);
25662566

@@ -2811,8 +2811,8 @@ public async Task BoxcarEvaluation_On404AfterRecheckingMetadata_ShouldThrowAuthZ
28112811

28122812
await sut.Evaluate(evaluationRequest);
28132813
var act = async () => await sut.Evaluate(evaluationRequest);
2814-
2815-
act.Should().ThrowAsync<AuthZenRequestFailureException>();
2814+
2815+
await act.Should().ThrowAsync<AuthZenRequestFailureException>();
28162816

28172817
calls.Should().Be(5);
28182818

src/CSharp/Rsk.AuthZen.Client/Rsk.AuthZen.Client.csproj

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@
33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
55
<LangVersion>8.0</LangVersion>
6+
7+
<Authors>Rock Solid Knowledge Ltd</Authors>
8+
<Description>AuthZen Client Library</Description>
9+
<PackageIcon>icon.png</PackageIcon>
10+
<PackageProjectUrl>https://github.com/RockSolidKnowledge/AuthZenClient</PackageProjectUrl>
11+
<PackageReleaseNotes>https://github.com/RockSolidKnowledge/AuthZenClient/releases</PackageReleaseNotes>
12+
<Copyright>Copyright 2026 (c) Rock Solid Knowledge Ltd. All rights reserved.</Copyright>
13+
<PackageTags>AuthZen</PackageTags>
14+
<IncludeSymbols>true</IncludeSymbols>
15+
<IncludeContentInPack>true</IncludeContentInPack>
16+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
17+
<PackageLicenseFile>license.txt</PackageLicenseFile>
18+
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
619
</PropertyGroup>
720

821
<ItemGroup>
@@ -11,4 +24,9 @@
1124
<PackageReference Include="System.Text.Json" Version="9.0.3" />
1225
</ItemGroup>
1326

27+
<ItemGroup>
28+
<None Include="license.txt" Pack="true" PackagePath="license.txt" />
29+
<None Include="../../../icon.png" Pack="true" PackagePath="" />
30+
</ItemGroup>
31+
1432
</Project>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Rock Solid Knowledge
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

src/Typescript/package.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "authzen-client",
3-
"version": "1.0.0",
4-
"description": "TypeScript client library for AuthZen Authorization API",
2+
"name": "@rocksolidknowledge/authzen-client",
3+
"version": "0.0.1",
4+
"description": "Client library for AuthZen Authorization API",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
77
"scripts": {
@@ -20,7 +20,7 @@
2020
"security",
2121
"typescript"
2222
],
23-
"author": "Your Name",
23+
"author": "Rock Solid Knowledge",
2424
"license": "MIT",
2525
"devDependencies": {
2626
"@babel/core": "^7.28.3",
@@ -44,6 +44,11 @@
4444
],
4545
"repository": {
4646
"type": "git",
47-
"url": "https://github.com/yourusername/authzen-client.git"
48-
}
47+
"url": "https://github.com/RockSolidKnowledge/AuthZenClient.git"
48+
},
49+
"type": "module",
50+
"bugs": {
51+
"url": "https://github.com/RockSolidKnowledge/AuthZenClient/issues"
52+
},
53+
"homepage": "https://github.com/RockSolidKnowledge/AuthZenClient#readme"
4954
}

src/Typescript/webpack.config.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1-
const path = require('path');
1+
import path from 'path';
2+
import { fileURLToPath } from 'url';
23

3-
module.exports = {
4+
const __filename = fileURLToPath(import.meta.url);
5+
const __dirname = path.dirname(__filename);
6+
7+
export default {
48
entry: "./src/index.ts",
59
output: {
610
path: path.join(__dirname, "dist"),
711
filename: "index.js",
812
library: {
9-
'name': 'AuthZenClient',
10-
'type': 'window'
13+
type: 'module'
1114
}
1215
},
16+
experiments: {
17+
outputModule: true
18+
},
1319
module: {
1420
rules: [
1521
{

0 commit comments

Comments
 (0)