Skip to content

Commit c4b619a

Browse files
Merge pull request #41 from infin8x/master
Authenticated package source support
2 parents 154c08a + dd19a56 commit c4b619a

File tree

518 files changed

+95765
-2945
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

518 files changed

+95765
-2945
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,6 @@ typings/
9090

9191
# DynamoDB Local files
9292
.dynamodb/
93+
94+
.vscode/*
9395
node_modules

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,33 @@ jobs:
4141
- run: dotnet build <my project>
4242
```
4343
44+
Authentication for nuget feeds:
45+
```yaml
46+
steps:
47+
- uses: actions/checkout@master
48+
# Authenticates packages to push to GPR
49+
- uses: actions/setup-dotnet@v1
50+
with:
51+
dotnet-version: '2.2.103' # SDK Version to use.
52+
source-url: https://nuget.pkg.github.com/<owner>/index.json
53+
env:
54+
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
55+
- run: dotnet build <my project>
56+
- name: Create the package
57+
run: dotnet pack --configuration Release <my project>
58+
- name: Publish the package to GPR
59+
run: dotnet nuget push <my project>/bin/Release/*.nupkg
60+
61+
# Authticates packages to push to Azure Artifacts
62+
- uses: actions/setup-dotnet@v1
63+
with:
64+
source-url: https://pkgs.dev.azure.com/<your-organization>/_packaging/<your-feed-name>/nuget/v3/index.json
65+
env:
66+
NUGET_AUTH_TOKEN: ${{secrets.AZURE_DEVOPS_PAT}} # Note, create a secret with this name in Settings
67+
- name: Publish the package to Azure Artifacts
68+
run: dotnet nuget push <my project>/bin/Release/*.nupkg
69+
```
70+
4471
# License
4572
4673
The scripts and documentation in this project are released under the [MIT License](LICENSE)
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`authutil tests Existing config not in repo root, sets up a partial NuGet.config user/PAT for GPR 1`] = `
4+
"<?xml version=\\"1.0\\"?>
5+
<configuration>
6+
<config>
7+
<add key=\\"defaultPushSource\\" value=\\"https://nuget.pkg.github.com/OwnerName/index.json\\"/>
8+
</config>
9+
<packageSourceCredentials>
10+
<GPR>
11+
<add key=\\"Username\\" value=\\"OwnerName\\"/>
12+
<add key=\\"ClearTextPassword\\" value=\\"TEST_FAKE_AUTH_TOKEN\\"/>
13+
</GPR>
14+
</packageSourceCredentials>
15+
</configuration>"
16+
`;
17+
18+
exports[`authutil tests Existing config w/ Azure Artifacts source and NuGet.org, sets up a partial NuGet.config user/PAT for GPR 1`] = `
19+
"<?xml version=\\"1.0\\"?>
20+
<configuration>
21+
<config>
22+
<add key=\\"defaultPushSource\\" value=\\"https://pkgs.dev.azure.com/amullans/_packaging/GitHubBuilds/nuget/v3/index.json\\"/>
23+
</config>
24+
<packageSourceCredentials>
25+
<AzureArtifacts>
26+
<add key=\\"Username\\" value=\\"OwnerName\\"/>
27+
<add key=\\"ClearTextPassword\\" value=\\"TEST_FAKE_AUTH_TOKEN\\"/>
28+
</AzureArtifacts>
29+
</packageSourceCredentials>
30+
</configuration>"
31+
`;
32+
33+
exports[`authutil tests Existing config w/ GPR source and NuGet.org, sets up a partial NuGet.config user/PAT for GPR 1`] = `
34+
"<?xml version=\\"1.0\\"?>
35+
<configuration>
36+
<config>
37+
<add key=\\"defaultPushSource\\" value=\\"https://nuget.pkg.github.com/OwnerName/index.json\\"/>
38+
</config>
39+
<packageSourceCredentials>
40+
<GPR>
41+
<add key=\\"Username\\" value=\\"OwnerName\\"/>
42+
<add key=\\"ClearTextPassword\\" value=\\"TEST_FAKE_AUTH_TOKEN\\"/>
43+
</GPR>
44+
</packageSourceCredentials>
45+
</configuration>"
46+
`;
47+
48+
exports[`authutil tests Existing config w/ no GPR sources, sets up a full NuGet.config with URL and user/PAT for GPR 1`] = `
49+
"<?xml version=\\"1.0\\"?>
50+
<configuration>
51+
<config>
52+
<add key=\\"defaultPushSource\\" value=\\"https://nuget.pkg.github.com/OwnerName/index.json\\"/>
53+
</config>
54+
<packageSources>
55+
<add key=\\"Source\\" value=\\"https://nuget.pkg.github.com/OwnerName/index.json\\"/>
56+
</packageSources>
57+
<packageSourceCredentials>
58+
<Source>
59+
<add key=\\"Username\\" value=\\"OwnerName\\"/>
60+
<add key=\\"ClearTextPassword\\" value=\\"TEST_FAKE_AUTH_TOKEN\\"/>
61+
</Source>
62+
</packageSourceCredentials>
63+
</configuration>"
64+
`;
65+
66+
exports[`authutil tests Existing config w/ no sources, sets up a full NuGet.config with URL and user/PAT for GPR 1`] = `
67+
"<?xml version=\\"1.0\\"?>
68+
<configuration>
69+
<config>
70+
<add key=\\"defaultPushSource\\" value=\\"https://nuget.pkg.github.com/OwnerName/index.json\\"/>
71+
</config>
72+
<packageSources>
73+
<add key=\\"Source\\" value=\\"https://nuget.pkg.github.com/OwnerName/index.json\\"/>
74+
</packageSources>
75+
<packageSourceCredentials>
76+
<Source>
77+
<add key=\\"Username\\" value=\\"OwnerName\\"/>
78+
<add key=\\"ClearTextPassword\\" value=\\"TEST_FAKE_AUTH_TOKEN\\"/>
79+
</Source>
80+
</packageSourceCredentials>
81+
</configuration>"
82+
`;
83+
84+
exports[`authutil tests Existing config w/ only Azure Artifacts source, sets up a partial NuGet.config user/PAT for GPR 1`] = `
85+
"<?xml version=\\"1.0\\"?>
86+
<configuration>
87+
<config>
88+
<add key=\\"defaultPushSource\\" value=\\"https://pkgs.dev.azure.com/amullans/_packaging/GitHubBuilds/nuget/v3/index.json\\"/>
89+
</config>
90+
<packageSourceCredentials>
91+
<AzureArtifacts>
92+
<add key=\\"Username\\" value=\\"OwnerName\\"/>
93+
<add key=\\"ClearTextPassword\\" value=\\"TEST_FAKE_AUTH_TOKEN\\"/>
94+
</AzureArtifacts>
95+
</packageSourceCredentials>
96+
</configuration>"
97+
`;
98+
99+
exports[`authutil tests Existing config w/ only GPR source, sets up a partial NuGet.config user/PAT for GPR 1`] = `
100+
"<?xml version=\\"1.0\\"?>
101+
<configuration>
102+
<config>
103+
<add key=\\"defaultPushSource\\" value=\\"https://nuget.pkg.github.com/OwnerName/index.json\\"/>
104+
</config>
105+
<packageSourceCredentials>
106+
<GPR>
107+
<add key=\\"Username\\" value=\\"OwnerName\\"/>
108+
<add key=\\"ClearTextPassword\\" value=\\"TEST_FAKE_AUTH_TOKEN\\"/>
109+
</GPR>
110+
</packageSourceCredentials>
111+
</configuration>"
112+
`;
113+
114+
exports[`authutil tests Existing config w/ two GPR sources, sets up a partial NuGet.config user/PAT for GPR 1`] = `
115+
"<?xml version=\\"1.0\\"?>
116+
<configuration>
117+
<config>
118+
<add key=\\"defaultPushSource\\" value=\\"https://nuget.pkg.github.com\\"/>
119+
</config>
120+
<packageSourceCredentials>
121+
<GPR-GitHub>
122+
<add key=\\"Username\\" value=\\"OwnerName\\"/>
123+
<add key=\\"ClearTextPassword\\" value=\\"TEST_FAKE_AUTH_TOKEN\\"/>
124+
</GPR-GitHub>
125+
<GPR-Actions>
126+
<add key=\\"Username\\" value=\\"OwnerName\\"/>
127+
<add key=\\"ClearTextPassword\\" value=\\"TEST_FAKE_AUTH_TOKEN\\"/>
128+
</GPR-Actions>
129+
</packageSourceCredentials>
130+
</configuration>"
131+
`;
132+
133+
exports[`authutil tests No existing config, sets up a full NuGet.config with URL and other owner/PAT for GPR 1`] = `
134+
"<?xml version=\\"1.0\\"?>
135+
<configuration>
136+
<config>
137+
<add key=\\"defaultPushSource\\" value=\\"https://nuget.pkg.github.com/otherorg/index.json\\"/>
138+
</config>
139+
<packageSources>
140+
<add key=\\"Source\\" value=\\"https://nuget.pkg.github.com/otherorg/index.json\\"/>
141+
</packageSources>
142+
<packageSourceCredentials>
143+
<Source>
144+
<add key=\\"Username\\" value=\\"otherorg\\"/>
145+
<add key=\\"ClearTextPassword\\" value=\\"TEST_FAKE_AUTH_TOKEN\\"/>
146+
</Source>
147+
</packageSourceCredentials>
148+
</configuration>"
149+
`;
150+
151+
exports[`authutil tests No existing config, sets up a full NuGet.config with URL and token for other source 1`] = `
152+
"<?xml version=\\"1.0\\"?>
153+
<configuration>
154+
<config>
155+
<add key=\\"defaultPushSource\\" value=\\"https://pkgs.dev.azure.com/amullans/_packaging/GitHubBuilds/nuget/v3/index.json\\"/>
156+
</config>
157+
<packageSources>
158+
<add key=\\"Source\\" value=\\"https://pkgs.dev.azure.com/amullans/_packaging/GitHubBuilds/nuget/v3/index.json\\"/>
159+
</packageSources>
160+
<packageSourceCredentials>
161+
<Source>
162+
<add key=\\"Username\\" value=\\"OwnerName\\"/>
163+
<add key=\\"ClearTextPassword\\" value=\\"TEST_FAKE_AUTH_TOKEN\\"/>
164+
</Source>
165+
</packageSourceCredentials>
166+
</configuration>"
167+
`;
168+
169+
exports[`authutil tests No existing config, sets up a full NuGet.config with URL and user/PAT for GPR 1`] = `
170+
"<?xml version=\\"1.0\\"?>
171+
<configuration>
172+
<config>
173+
<add key=\\"defaultPushSource\\" value=\\"https://nuget.pkg.github.com/OwnerName/index.json\\"/>
174+
</config>
175+
<packageSources>
176+
<add key=\\"Source\\" value=\\"https://nuget.pkg.github.com/OwnerName/index.json\\"/>
177+
</packageSources>
178+
<packageSourceCredentials>
179+
<Source>
180+
<add key=\\"Username\\" value=\\"OwnerName\\"/>
181+
<add key=\\"ClearTextPassword\\" value=\\"TEST_FAKE_AUTH_TOKEN\\"/>
182+
</Source>
183+
</packageSourceCredentials>
184+
</configuration>"
185+
`;

0 commit comments

Comments
 (0)