Skip to content

Commit d4ad428

Browse files
authored
Merge pull request #2 from Keyfactor/ci_fixes
Ci fixes
2 parents f28209b + 2c7c5e2 commit d4ad428

File tree

2 files changed

+54
-11
lines changed

2 files changed

+54
-11
lines changed

.github/workflows/sync-nuget.yml

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,29 @@ jobs:
2525
with:
2626
dotnet-version: '8.0.x'
2727

28-
- name: Install NuGet CLI
29-
uses: nuget/[email protected]
30-
with:
31-
nuget-version: '5.x'
28+
# Install Mono (runtime for .exe files)
29+
- name: Install Mono
30+
run: |
31+
sudo apt-get update
32+
sudo apt-get install -y mono-complete
33+
34+
# Download nuget.exe if you don't already have it
35+
- name: Download nuget.exe
36+
run: |
37+
mkdir -p $HOME/.nuget
38+
curl -L https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -o $HOME/.nuget/nuget.exe
39+
40+
# Create a shim so 'nuget' works just like on macOS
41+
- name: Create nuget shim
42+
run: |
43+
echo '#!/usr/bin/env bash' > /usr/local/bin/nuget
44+
echo "mono $HOME/.nuget/nuget.exe \"\$@\"" >> /usr/local/bin/nuget
45+
chmod +x /usr/local/bin/nuget
46+
47+
# - name: Install NuGet CLI
48+
# uses: nuget/[email protected]
49+
# with:
50+
# nuget-version: '5.x'
3251

3352
- name: Install Python dependencies
3453
run: |
@@ -41,15 +60,23 @@ jobs:
4160
echo '<?xml version="1.0" encoding="utf-8"?>' > ~/.nuget/NuGet/NuGet.Config
4261
echo '<configuration>' >> ~/.nuget/NuGet/NuGet.Config
4362
echo ' <packageSources>' >> ~/.nuget/NuGet/NuGet.Config
44-
echo ' <add key="Azure DevOps" value="https://pkgs.dev.azure.com/Keyfactor/_packaging/KeyfactorPackages/nuget/v3/index.json" />' >> ~/.nuget/NuGet/NuGet.Config
63+
echo ' <add key="keyfactor" value="https://pkgs.dev.azure.com/Keyfactor/_packaging/KeyfactorPackages/nuget/v3/index.json" />' >> ~/.nuget/NuGet/NuGet.Config
64+
echo ' <add key="github" value="https://nuget.pkg.github.com/Keyfactor/index.json" />' >> ~/.nuget/NuGet/NuGet.Config
4565
echo ' </packageSources>' >> ~/.nuget/NuGet/NuGet.Config
4666
echo ' <packageSourceCredentials>' >> ~/.nuget/NuGet/NuGet.Config
47-
echo ' <Azure_x0020_DevOps>' >> ~/.nuget/NuGet/NuGet.Config
48-
echo ' <add key="Username" value="user" />' >> ~/.nuget/NuGet/NuGet.Config
67+
echo ' <github>' >> ~/.nuget/NuGet/NuGet.Config
68+
echo ' <add key="Username" value="spbsoluble" />' >> ~/.nuget/NuGet/NuGet.Config
69+
echo ' <add key="ClearTextPassword" value="${{ secrets.GH_NUGET_TOKEN }}" />' >> ~/.nuget/NuGet/NuGet.Config
70+
echo ' </github>' >> ~/.nuget/NuGet/NuGet.Config
71+
echo ' <keyfactor>' >> ~/.nuget/NuGet/NuGet.Config
72+
echo ' <add key="Username" value="AzureDevOps" />' >> ~/.nuget/NuGet/NuGet.Config
4973
echo ' <add key="ClearTextPassword" value="${{ secrets.AZ_DEVOPS_PAT }}" />' >> ~/.nuget/NuGet/NuGet.Config
50-
echo ' </Azure_x0020_DevOps>' >> ~/.nuget/NuGet/NuGet.Config
74+
echo ' </keyfactor>' >> ~/.nuget/NuGet/NuGet.Config
5175
echo ' </packageSourceCredentials>' >> ~/.nuget/NuGet/NuGet.Config
5276
echo '</configuration>' >> ~/.nuget/NuGet/NuGet.Config
77+
cat ~/.nuget/NuGet/NuGet.Config
78+
env:
79+
GITHUB_TOKEN: ${{ secrets.GH_NUGET_TOKEN }}
5380

5481
- name: Run NuGet sync script
5582
run: python scripts/sync_nuget.py

README.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,27 @@ Studio or other development tools.
88
Some package availability changes from time to time. Please view the `CHANGELOG.md` for further details on changes to
99
available libraries.
1010

11-
## Adding a package source
11+
## Adding a Nuget Package and/or Version
1212

13-
In order to add a nuget package to the keyfactor GPR, you must download from the DevOps Artifacts site and then push it
14-
to the GitHub Package Registry (GPR) using a Personal Access Token (PAT).
13+
### Via GitHub Actions
1514

15+
To add a Nuget package modify the [packages.yml](./packages.yml) file in the root of this repository.
16+
17+
> [!IMPORTANT]
18+
> The package and version must exist in this Nuget repository before it can be added to the `packages.yml` file.
19+
> https://dev.azure.com/Keyfactor/Engineering/_artifacts/feed/KeyfactorPackages@Local
20+
21+
The to trigger the sync run the
22+
workflow [Sync NuGet Packages](https://github.com/Keyfactor/public-nuget-packages/actions/workflows/sync-nuget.yml). Once
23+
it's complete, the package will be available in the Keyfactor Public GitHub Package Registry (GPR).
24+
25+
### Manually using dotnet CLI
26+
27+
In order to add a nuget package to the Keyfactor Public GitHub Package Registry (GPR), you must download from the
28+
[DevOps Artifacts site](https://dev.azure.com/Keyfactor/Engineering/_artifacts/feed/KeyfactorPackages@Local)
29+
and then push it to the GPR using a Personal Access Token (PAT).
30+
31+
Steps:
1632
1. Create a new PAT with access with `write:packages` access
1733
2. Grant SSO to the PAT
1834
3. Run the following command to push the package to the GitHub Package Registry (GPR):

0 commit comments

Comments
 (0)