Skip to content

Commit 089a66d

Browse files
committed
Update NuGet package to reference Defra prefix
1 parent c579985 commit 089a66d

1 file changed

Lines changed: 21 additions & 21 deletions

File tree

docs/guides/shared_libraries.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Two package ecosystems align to Defra's primary technology choices.
88

99
**npm** packages are used in JavaScript projects. They are hosted on [npmjs.com](https://www.npmjs.com) and installed using the `npm` command. Packages can be scoped to an organisation, such as `@defra/your-package`.
1010

11-
**NuGet** packages are used in .NET projects. They are hosted on [nuget.org](https://www.nuget.org) and installed using the `dotnet add package` command. Packages are grouped under an organisation, such as `DefraDigital.YourPackage`.
11+
**NuGet** packages are used in .NET projects. They are hosted on [nuget.org](https://www.nuget.org) and installed using the `dotnet add package` command. Packages are grouped under an organisation, such as `Defra.YourPackage`.
1212

1313
## When a shared library can be useful
1414

@@ -181,11 +181,11 @@ The first publish of any `@defra`-scoped package must be done by a Defra npm org
181181

182182
Publish NuGet packages to [nuget.org](https://www.nuget.org) under the [Defra NuGet organisation](https://www.nuget.org/profiles/Defra).
183183

184-
The `Defra` package ID prefix is reserved on NuGet.org and package IDs using it may be rejected. Use the `DefraDigital` prefix instead:
184+
The `Defra` package ID prefix is reserved on NuGet.org for the `Defra` organisation and should be used for all packages. Examples of valid package IDs include:
185185

186186
```text
187-
DefraDigital.YourPackage
188-
DefraDigital.Team.Component
187+
Defra.YourPackage
188+
Defra.Team.Component
189189
```
190190

191191
For onboarding, contact [`#nuget-support`](https://defra-digital.slack.com/archives/C0B9RF36WTH) in Slack. A Defra NuGet org admin will add you as a Collaborator to the Defra organisation on NuGet.org.
@@ -203,7 +203,7 @@ Contact `#nuget-support` in Slack with:
203203
- your NuGet.org username
204204
- your team name
205205
- the GitHub repository that will publish the package
206-
- the proposed package ID (for example `DefraDigital.YourPackage`)
206+
the proposed package ID (for example `Defra.YourPackage`)
207207
- confirmation the package is suitable for public publishing
208208

209209
Make sure your NuGet.org account uses a secure Microsoft account with MFA enabled.
@@ -213,29 +213,29 @@ Make sure your NuGet.org account uses a secure Microsoft account with MFA enable
213213
Create a new GitHub repository under the DEFRA organisation, then create a solution, class library and test project:
214214

215215
```bash
216-
dotnet new sln --name DefraDigital.YourPackage
216+
dotnet new sln --name Defra.YourPackage
217217
218218
dotnet new classlib \
219-
--name DefraDigital.YourPackage \
220-
--output DefraDigital.YourPackage
219+
--name Defra.YourPackage \
220+
--output Defra.YourPackage
221221
222222
dotnet new xunit \
223-
--name DefraDigital.YourPackage.Tests \
224-
--output DefraDigital.YourPackage.Tests
223+
--name Defra.YourPackage.Tests \
224+
--output Defra.YourPackage.Tests
225225
226-
dotnet sln add DefraDigital.YourPackage/DefraDigital.YourPackage.csproj
227-
dotnet sln add DefraDigital.YourPackage.Tests/DefraDigital.YourPackage.Tests.csproj
226+
dotnet sln add Defra.YourPackage/Defra.YourPackage.csproj
227+
dotnet sln add Defra.YourPackage.Tests/Defra.YourPackage.Tests.csproj
228228
229-
dotnet add DefraDigital.YourPackage.Tests/DefraDigital.YourPackage.Tests.csproj \
230-
reference DefraDigital.YourPackage/DefraDigital.YourPackage.csproj
229+
dotnet add Defra.YourPackage.Tests/Defra.YourPackage.Tests.csproj \
230+
reference Defra.YourPackage/Defra.YourPackage.csproj
231231
```
232232

233-
Replace `DefraDigital.YourPackage` with your actual package ID.
233+
Replace `Defra.YourPackage` with your actual package ID.
234234

235235
**3. Add package metadata to the `.csproj`**
236236

237237
```xml
238-
<PackageId>DefraDigital.YourPackage</PackageId>
238+
<PackageId>Defra.YourPackage</PackageId>
239239
<Version>0.1.0</Version>
240240
<Authors>Authors</Authors>
241241
<Company>Defra</Company>
@@ -272,13 +272,13 @@ Key version check steps:
272272
- name: Get current version
273273
id: current-version
274274
run: |
275-
echo "version=$(grep -oP '(?<=<Version>)[^<]+' DefraDigital.YourPackage/DefraDigital.YourPackage.csproj)" >> $GITHUB_OUTPUT
275+
echo "version=$(grep -oP '(?<=<Version>)[^<]+' Defra.YourPackage/Defra.YourPackage.csproj)" >> $GITHUB_OUTPUT
276276
277277
- name: Get main branch version
278278
id: base-version
279279
run: |
280280
git fetch origin main --depth=1
281-
echo "version=$(git show origin/main:DefraDigital.YourPackage/DefraDigital.YourPackage.csproj | grep -oP '(?<=<Version>)[^<]+')" >> $GITHUB_OUTPUT
281+
echo "version=$(git show origin/main:Defra.YourPackage/Defra.YourPackage.csproj | grep -oP '(?<=<Version>)[^<]+')" >> $GITHUB_OUTPUT
282282
283283
- name: Check version incremented
284284
run: |
@@ -296,7 +296,7 @@ Key version check steps:
296296
fi
297297
```
298298

299-
Replace `DefraDigital.YourPackage` with your package ID and project path.
299+
Replace `Defra.YourPackage` with your package ID and project path.
300300

301301
**5. Add a publish workflow**
302302

@@ -329,7 +329,7 @@ jobs:
329329
- run: dotnet test --configuration Release --no-build
330330
331331
- name: Pack
332-
run: dotnet pack DefraDigital.YourPackage/DefraDigital.YourPackage.csproj --configuration Release --no-build --output artifacts
332+
run: dotnet pack Defra.YourPackage/Defra.YourPackage.csproj --configuration Release --no-build --output artifacts
333333
334334
- name: NuGet login
335335
id: login
@@ -341,7 +341,7 @@ jobs:
341341
run: dotnet nuget push "artifacts/*.nupkg" --api-key "${{ steps.login.outputs.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
342342
```
343343

344-
Replace `DefraDigital.YourPackage` with your package ID and project path.
344+
Replace `Defra.YourPackage` with your package ID and project path.
345345

346346
**6. Add the `NUGET_USERNAME` secret**
347347

0 commit comments

Comments
 (0)