Skip to content

Commit 90b6fcd

Browse files
authored
Merge branch 'main' into dependabot/nuget/src/AndDoneSecureClientLibrary/Newtonsoft.Json-13.0.4
2 parents 0a9f863 + 286a560 commit 90b6fcd

7 files changed

Lines changed: 257 additions & 14 deletions

File tree

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Publish Package (Dev)
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
8+
jobs:
9+
build-and-publish:
10+
runs-on: ubuntu-latest
11+
12+
permissions:
13+
contents: read
14+
packages: write
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Setup .NET
21+
uses: actions/setup-dotnet@v4
22+
with:
23+
dotnet-version: '8.0.x'
24+
25+
- name: Authenticate GitHub Packages
26+
run: |
27+
dotnet nuget remove source githubanddone --configfile src/AndDoneSecureClientLibrary/nuget.config
28+
dotnet nuget add source \
29+
--username ${{ github.repository_owner }} \
30+
--password ${{ secrets.CLIENT_LIBRARY_NUGET_AUTH_TOKEN }} \
31+
--store-password-in-clear-text \
32+
--name githubanddone \
33+
--configfile src/AndDoneSecureClientLibrary/nuget.config \
34+
"https://nuget.pkg.github.com/AndDone-LLC/index.json"
35+
36+
- name: Restore dependencies
37+
run: dotnet restore
38+
39+
- name: Build
40+
run: dotnet build --configuration Release --no-restore
41+
42+
- name: Run tests
43+
run: dotnet test --configuration Release --no-restore --no-build
44+
45+
- name: Pack
46+
run: dotnet pack --configuration Release --no-build --output ./nupkg /p:VersionSuffix=dev.${{ github.run_number }}
47+
48+
- name: Push to GitHub Packages (Private)
49+
run: |
50+
dotnet nuget push ./nupkg/*.nupkg \
51+
--api-key ${{ secrets.CLIENT_LIBRARY_NUGET_AUTH_TOKEN }} \
52+
--source "https://nuget.pkg.github.com/AndDone-LLC/index.json" \
53+
--skip-duplicate

.github/workflows/publish-main.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Publish Package (Production)
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
mirror-and-publish:
10+
runs-on: ubuntu-latest
11+
# limit this to running only on our private repo to avoid duplicate action when we push to the public repo
12+
if: github.repository == 'AndDone-LLC/AndDone-SecureAPI-ClientLibrary-DotNet-private'
13+
permissions:
14+
contents: read
15+
packages: write
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
persist-credentials: false
23+
- name: Debug repo access
24+
run: |
25+
echo "PUBLIC_REPO value: ${{ vars.PUBLIC_REPO }}"
26+
curl -s -o /dev/null -w "%{http_code}" \
27+
-H "Authorization: token ${{ secrets.CLIENT_LIBRARY_NUGET_AUTH_TOKEN }}" \
28+
https://api.github.com/repos/${{ vars.PUBLIC_REPO }}
29+
# ── Mirror to Public Repo ──────────────────────────────────
30+
- name: Push to public repo
31+
run: |
32+
git remote add public https://x-access-token:${{ secrets.CLIENT_LIBRARY_NUGET_AUTH_TOKEN }}@github.com/${{ vars.PUBLIC_REPO }}.git
33+
git push public main --force
34+
35+
# ── Build & Publish to Public Account ──────────────────────
36+
- name: Setup .NET
37+
uses: actions/setup-dotnet@v4
38+
with:
39+
dotnet-version: '8.0.x'
40+
41+
- name: Authenticate GitHub Packages
42+
run: |
43+
dotnet nuget remove source githubanddone --configfile src/AndDoneSecureClientLibrary/nuget.config
44+
dotnet nuget add source \
45+
--username ${{ github.repository_owner }} \
46+
--password ${{ secrets.CLIENT_LIBRARY_NUGET_AUTH_TOKEN }} \
47+
--store-password-in-clear-text \
48+
--name githubanddone \
49+
--configfile src/AndDoneSecureClientLibrary/nuget.config \
50+
"https://nuget.pkg.github.com/AndDone-LLC/index.json"
51+
52+
- name: Restore dependencies
53+
run: dotnet restore
54+
55+
- name: Build
56+
run: dotnet build --configuration Release --no-restore
57+
58+
- name: Run tests
59+
run: dotnet test --configuration Release --no-restore --no-build
60+
61+
- name: Pack
62+
run: dotnet pack --configuration Release --no-build --output ./nupkg /p:RepositoryUrl=https://github.com/anddone-kit/AndDone-SecureAPI-ClientLibrary-DotNet.git
63+
64+
- name: Push to GitHub Packages (Public)
65+
run: |
66+
PUBLIC_OWNER=$(echo "${{ vars.PUBLIC_REPO }}" | cut -d'/' -f1)
67+
68+
dotnet nuget push ./nupkg/*.nupkg \
69+
--api-key ${{ secrets.CLIENT_LIBRARY_NUGET_AUTH_TOKEN }} \
70+
--source "https://nuget.pkg.github.com/$PUBLIC_OWNER/index.json" \
71+
--skip-duplicate

README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ Please see our developer documentation & API Explorer, linked below, for detaile
88
**Secure API .NET Client**
99

1010
This .NET SDK is an auto-generated client for the AndDone Secure API, built using the [OpenAPI Generator](https://openapi-generator.tech).
11+
This .NET SDK targets both .Net 8 and NetStandard 2.0 for client consumption. Based on the client's target framework, the appropriate Nuget package will be pulled when referenced.
1112

1213
* **API version**: 2.3
13-
* **Package version**: 1.0.0
14+
* **Package version**: 1.0.3
1415
* **Generator version**: 7.9.0
1516
* **Build package**: `org.openapitools.codegen.languages.CSharpClientCodegen`
1617
* **Developer Documentation**: [DevDocs](https://docs.anddone.com/)
@@ -27,6 +28,7 @@ This .NET SDK is an auto-generated client for the AndDone Secure API, built usin
2728
* [API Endpoints](#api-endpoints)
2829
* [Models](#models)
2930
* [Authorization](#authorization)
31+
* [Including library](#including-library)
3032
* [Support & Versioning](#support--versioning)
3133

3234
---
@@ -162,6 +164,8 @@ catch (ApiException e)
162164

163165
---
164166

167+
168+
165169
## API Endpoints
166170

167171
All URIs are relative to:
@@ -429,6 +433,24 @@ Class | Method | HTTP request | Description
429433

430434
---
431435

436+
## Including library
437+
You can include this **AndDone's DotNet client library** in your project manually or within Visual Studio. Note that the first time you include the library, you may be prompted to enter your GitHub credentials.
438+
439+
#### Manually
440+
1. Add the package source reference to the local machine by running the following in Powershell:
441+
```sh
442+
dotnet nuget add source --name githubanddone "https://nuget.pkg.github.com/AndDone-kit/index.json"
443+
```
444+
2. In your .csproj file, add a package reference to:
445+
```sh
446+
<PackageReference Include="AndDoneSecureClientLibrary" Version="1.0.0" />
447+
```
448+
449+
#### Within Visual Studio
450+
To include the **AndDone's DotNet client library** in your project, a nuget.config file is included at the solution level to reference the package library.
451+
452+
453+
432454
## Authorization
433455

434456
Authentication is handled via API keys in HTTP headers:
@@ -445,4 +467,4 @@ Authentication is handled via API keys in HTTP headers:
445467
## Support & Versioning
446468

447469
* **API Environments:** Use UAT for testing; switch to Production only after validation.
448-
* **Issues:** Report bugs or request features via the [GitHub Issues](https://github.com/anddone-kit/AndDone-SecureAPI-ClientLibrary-DotNet/issues) page.
470+
* **Issues:** Report bugs or request features via the [GitHub Issues](https://github.com/anddone-kit/AndDone-SecureAPI-ClientLibrary-DotNet/issues) page.

documentation/packaging.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# AndDone Client Library - .NET - Packaging
2+
3+
## Packaging
4+
5+
The GitHub Container Repository (GHCR) will be used to house the NuGet package for client consumption.
6+
7+
1. Create a GitHub Personal Access Token (PAT)
8+
1. Login to GitHub
9+
2. Select User -> Settings -> Developer Settings -> Personal access tokens -> Tokens (classic)
10+
3. select Generate new token -> Generate new token (classic)
11+
4. Give an identifiable description name
12+
5. Copy Token to be used below as GH_PAT
13+
6. Add the GHCR reference to the local machine by running:
14+
dotnet nuget add source --username {GH_USER} --password {GH_PAT} --store-password-in-clear-text --name githubanddone "https://nuget.pkg.github.com/AndDone-LLC/index.json"
15+
16+
2. Create Package and Push (command line)
17+
1. Open a Powershell window
18+
2. Create a new folder in the workspace folder of choice (ex: d:\workspace\anddone)
19+
```sh
20+
cd d:\workspace
21+
mkdir anddoneclientlibrary
22+
```
23+
3. Change to the new folder
24+
```sh
25+
cd anddoneclientlibrary
26+
```
27+
4. Clone the repository
28+
```sh
29+
git clone https://github.com/AndDone-LLC/AndDone-SecureAPI-ClientLibrary-DotNet-private.git
30+
````
31+
5. Open nuget.config file in the Project root (AndDone-SecureAPI-ClientLibrary-DotNet-private\src\AndDoneSecureClientLibrary) and modify {GH_USER} and {GH_PAT}
32+
6. Verify the <RepositoryUrl> in .csproj file is correct
33+
7. Update the Version in .csproj as needed
34+
8. Navigate to AndDone-SecureAPI-ClientLibrary-DotNet-private\src\AndDoneSecureClientLibrary
35+
```sh
36+
cd src\AndDoneSecureClientLibrary
37+
```
38+
9. Package the project to create the .nupkg file
39+
```sh
40+
dotnet pack --configuration Release
41+
```
42+
10. Push the package to GHCR
43+
```sh
44+
dotnet nuget push "bin\Release\AndDoneSecureClientLibrary.1.0.0.nupkg" --api-key {GH_PAT} --source "githubanddone" --skip-duplicate
45+
```
46+
47+
3. Create Package and Push (Visual Studio)
48+
1. Open a Powershell window
49+
2. Create a new folder in the workspace folder of choice (ex: d:\workspace\anddone)
50+
```sh
51+
cd d:\workspace
52+
mkdir anddoneclientlibrary
53+
```
54+
3. Change to the new folder
55+
```sh
56+
cd anddoneclientlibrary
57+
```
58+
4. Clone the repository
59+
```sh
60+
git clone https://github.com/AndDone-LLC/AndDone-SecureAPI-ClientLibrary-DotNet-private.git
61+
````
62+
5. Open AndDoneSecureClientLibrary.sln
63+
6. Change the build configuration dropdown to Release
64+
7. Modify nuget.config file in Project root with {GH_USER} and {GH_PAT}
65+
8. Verify <RepositoryUrl> in the .csproj file is correct
66+
9. Update Version in the .csproj as needed
67+
10. Right click on Solution in Solution Explorer and Build Solution
68+
11. Right click on the Project in Solution Explorer and Pack
69+
12. In the Powershell window
70+
```sh
71+
cd AndDone-SecureAPI-ClientLibrary-DotNet-private\src\AndDoneSecureClientLibrary
72+
```
73+
13. Push the package to GHCR
74+
```sh
75+
dotnet nuget push "bin\Release\AndDoneSecureClientLibrary.1.0.0.nupkg" --api-key {GH_PAT} --source "githubanddone" --skip-duplicate
76+
```
77+
78+
4. Associate Package to Repository
79+
1. In GitHub -> Select User -> Organizations
80+
2. Select AndDone-LLC
81+
3. Click Packages in top menu
82+
4. Click Package Name
83+
5. In right side, Click Package Settings
84+
6. Click Add Repository and select Repository for Package
85+
7. Verify by going to GitHub code page and the Package will be listed on the right side
86+
87+
88+

src/AndDoneSecureClientLibrary.Test/AndDoneSecureClientLibrary.Test.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
<PropertyGroup>
44
<AssemblyName>AndDoneSecureClientLibrary.Test</AssemblyName>
55
<RootNamespace>AndDoneSecureClientLibrary.Test</RootNamespace>
6-
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
6+
<TargetFramework>net8.0</TargetFramework>
77
<IsPackable>false</IsPackable>
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.2" />
12-
<PackageReference Include="xunit" Version="2.4.2" />
13-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" />
11+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.4.0" />
12+
<PackageReference Include="xunit" Version="2.9.3" />
13+
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5" />
1414
</ItemGroup>
1515

1616
<ItemGroup>

src/AndDoneSecureClientLibrary/AndDoneSecureClientLibrary.csproj

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,26 @@
66
<AssemblyName>AndDoneSecureClientLibrary</AssemblyName>
77
<PackageId>AndDoneSecureClientLibrary</PackageId>
88
<OutputType>Library</OutputType>
9-
<Authors>OpenAPI</Authors>
10-
<Company>OpenAPI</Company>
11-
<AssemblyTitle>OpenAPI Library</AssemblyTitle>
12-
<Description>A library generated from a OpenAPI doc</Description>
9+
<Authors>AndDone</Authors>
10+
<Company>AndDone LLC</Company>
11+
<AssemblyTitle>AndDone Secure Client Library</AssemblyTitle>
12+
<Description>Client library for AndDone Secure API</Description>
1313
<Copyright>No Copyright</Copyright>
1414
<RootNamespace>AndDoneSecureClientLibrary</RootNamespace>
15-
<Version>1.0.0</Version>
15+
<Version>1.0.6</Version>
1616
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\AndDoneSecureClientLibrary.xml</DocumentationFile>
17-
<RepositoryUrl>https://github.com/GIT_USER_ID/GIT_REPO_ID.git</RepositoryUrl>
17+
<RepositoryUrl>https://github.com/AndDone-LLC/AndDone-SecureAPI-ClientLibrary-DotNet-private.git</RepositoryUrl>
1818
<RepositoryType>git</RepositoryType>
1919
<PackageReleaseNotes>Minor update</PackageReleaseNotes>
2020
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
21+
<IsPackable>true</IsPackable>
2122
</PropertyGroup>
2223

2324
<ItemGroup>
2425
<PackageReference Include="JsonSubTypes" Version="2.0.1" />
2526
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
26-
<PackageReference Include="RestSharp" Version="112.0.0" />
27-
<PackageReference Include="Polly" Version="8.1.0" />
27+
<PackageReference Include="RestSharp" Version="114.0.0" />
28+
<PackageReference Include="Polly" Version="8.6.6" />
2829
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
2930
</ItemGroup>
3031

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<clear />
5+
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
6+
<add key="githubanddone" value="https://nuget.pkg.github.com/AndDone-LLC/index.json" />
7+
</packageSources>
8+
</configuration>

0 commit comments

Comments
 (0)