Skip to content

Commit 415d049

Browse files
.NET add document on packaging && disable uploading artifacts folder to pipeline by default (#4299)
* add package readme * Update PACKAGING.md
1 parent 6e4609a commit 415d049

File tree

4 files changed

+71
-7
lines changed

4 files changed

+71
-7
lines changed

.azure/pipelines/build.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@ trigger:
33
include:
44
- main
55
paths:
6-
exclude:
7-
- samples
6+
include:
7+
- dotnet
88

99
schedules:
1010
- cron: "0 0 * * *"
1111
displayName: 'Daily midnight build (including CodeQL)'
1212
branches:
1313
include:
1414
- main
15-
- 3.x
1615
always: true
1716

1817
parameters:
@@ -46,6 +45,10 @@ parameters:
4645
- name: publish_nightly
4746
displayName: Publish to autogen-nightly
4847
type: boolean
48+
default: true
49+
- name: publish_artifacts
50+
displayName: Publish artifacts
51+
type: boolean
4952
default: false
5053
- name: runCodeQL3000
5154
default: false
@@ -87,4 +90,5 @@ extends:
8790
skip_test: ${{ parameters.skip_test }}
8891
publish_nightly: ${{ parameters.publish_nightly }}
8992
publish_nuget: ${{ parameters.publish_nuget }}
90-
runCodeQL3000: ${{ parameters.runCodeQL3000 }}
93+
runCodeQL3000: ${{ parameters.runCodeQL3000 }}
94+
publish_artifacts: ${{ parameters.publish_artifacts }}

.azure/pipelines/templates/build.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ parameters:
3030
displayName: Publish to nuget.org
3131
type: boolean
3232
default: false
33+
- name: publish_artifacts
34+
displayName: Publish artifacts
35+
type: boolean
36+
default: false
3337
- name: runCodeQL3000
3438
default: false
3539
displayName: Run CodeQL3000 tasks
@@ -49,9 +53,11 @@ jobs:
4953
${{ if ne(variables['System.TeamProject'], 'GitHub - PR Builds') }}:
5054
templateContext:
5155
outputs:
52-
- output: pipelineArtifact
53-
targetPath: '$(build.sourcesdirectory)/dotnet/artifacts'
54-
artifactName: artifacts folder
56+
# Publish artifacts if enabled
57+
- ${{ if eq(parameters.publish_artifacts, true) }}: # TODO add eq(parameters.codesign, true)
58+
- output: pipelineArtifact
59+
targetPath: '$(build.sourcesdirectory)/dotnet/artifacts'
60+
artifactName: artifacts folder
5561
# Publish packages to nightly
5662
- ${{ if eq(parameters.publish_nightly, true) }}: # TODO add eq(parameters.codesign, true)
5763
- output: nuget

dotnet/PACKAGING.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Packaging AutoGen.NET
2+
3+
This document describes the steps to pack the `AutoGen.NET` project.
4+
5+
## Prerequisites
6+
7+
- .NET SDK
8+
9+
## Create Package
10+
11+
1. **Restore and Build the Project**
12+
```bash
13+
dotnet restore
14+
dotnet build --configuration Release --no-restore
15+
```
16+
17+
18+
2. **Create the NuGet Package**
19+
```bash
20+
dotnet pack --configuration Release --no-build
21+
```
22+
23+
This will generate both the `.nupkg` file and the `.snupkg` file in the `./artifacts/package/release` directory.
24+
25+
For more details, refer to the [official .NET documentation](https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-pack).
26+
27+
## Add new project to package list.
28+
By default, when you add a new project to `AutoGen.sln`, it will not be included in the package list. To include the new project in the package, you need to add the following line to the new project's `.csproj` file
29+
30+
e.g.
31+
32+
```xml
33+
<Import Project="$(RepoRoot)/nuget/nuget-package.props" />
34+
```
35+
36+
The `nuget-packages.props` enables `IsPackable` to `true` for the project, it also sets nenecessary metadata for the package.
37+
38+
For more details, refer to the [NuGet folder](./nuget/README.md).
39+
40+
## Package versioning
41+
The version of the package is defined by `VersionPrefix` and `VersionPrefixForAutoGen0_2` in [MetaInfo.props](./eng/MetaInfo.props). If the name of your project starts with `AutoGen.`, the version will be set to `VersionPrefixForAutoGen0_2`, otherwise it will be set to `VersionPrefix`.

dotnet/nuget/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# NuGet Directory
2+
3+
This directory contains resources and metadata for packaging the AutoGen.NET SDK as a NuGet package.
4+
5+
## Files
6+
7+
- **icon.png**: The icon used for the NuGet package.
8+
- **NUGET.md**: The readme file displayed on the NuGet package page.
9+
- **NUGET-PACKAGE.PROPS**: The MSBuild properties file that defines the packaging settings for the NuGet package.
10+
11+
## Purpose
12+
13+
The files in this directory are used to configure and build the NuGet package for the AutoGen.NET SDK, ensuring that it includes necessary metadata, documentation, and resources.

0 commit comments

Comments
 (0)