|
| 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 | + |
0 commit comments