From 0683b4d0b3d51391a2114bea67bbe89f194b57f4 Mon Sep 17 00:00:00 2001 From: CritasWang Date: Wed, 7 Jan 2026 17:22:00 +0800 Subject: [PATCH 1/5] fix ci --- .github/workflows/pre-commit-format.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pre-commit-format.yml b/.github/workflows/pre-commit-format.yml index de31eb7..a540aa1 100644 --- a/.github/workflows/pre-commit-format.yml +++ b/.github/workflows/pre-commit-format.yml @@ -20,6 +20,8 @@ jobs: env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 DOTNET_CLI_TELEMETRY_OPTOUT: 1 + TMPDIR: ${{ runner.temp }} + DOTNET_CLI_HOME: ${{ runner.temp }}/dotnet-home steps: - uses: actions/checkout@v4 @@ -37,6 +39,8 @@ jobs: - name: Clean dotnet temporary folder run: | sudo rm -rf /tmp/.dotnet + rm -rf "$TMPDIR/.dotnet" "$DOTNET_CLI_HOME" + mkdir -p "$TMPDIR/.dotnet" "$DOTNET_CLI_HOME" - name: Install pre-commit and dependencies run: | @@ -44,8 +48,5 @@ jobs: pre-commit install-hooks - name: Run pre-commit checks - env: - TMPDIR: ${{ runner.temp }} - DOTNET_CLI_HOME: ${{ runner.temp }} run: | pre-commit run --all-files From 148e2a97d96380a656c49e98b5298705cb085fb6 Mon Sep 17 00:00:00 2001 From: CritasWang Date: Wed, 7 Jan 2026 17:27:10 +0800 Subject: [PATCH 2/5] test --- PUBLISH.md | 58 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 20 deletions(-) diff --git a/PUBLISH.md b/PUBLISH.md index 86013a3..eeba1a1 100644 --- a/PUBLISH.md +++ b/PUBLISH.md @@ -1,36 +1,44 @@ # Publish your own nuget package + In this doc, we will introduce how to package and publish your own nuget package. Note that this will include the packaging and release of the two packages. ## Package + ### Step 1: Rename -Rename the following files/directories, where PACKAGE_NAME is the package name you expect. + +Rename the following files/directories, where PACKAGE_NAME is the package name you expect. Note that this name should be unique, otherwise it will be rejected. You can search at [nuget.org](https://www.nuget.org/) to confirm whether the name is unique. -- `./src/Apache.IoTDB` => `./src/PACKAGE_NAME` -- `./src/Apache.IoTDB/Apache.IoTDB.csproj` => `./src/PACKAGE_NAME/PACKAGE_NAME.csproj` -- `./src/Apache.IoTDB.Rpc.Generated` => `./src/PACKAGE_NAME.Rpc.Generated` -- `./src/Apache.IoTDB.Rpc.Generated/Apache.IoTDB.Rpc.Generated.csproj` => `./src/PACKAGE_NAME.Rpc.Generated/PACKAGE_NAME.Rpc.Generated.csproj` + +- `./src/Apache.IoTDB` => `./src/PACKAGE_NAME` +- `./src/Apache.IoTDB/Apache.IoTDB.csproj` => `./src/PACKAGE_NAME/PACKAGE_NAME.csproj` +- `./src/Apache.IoTDB.Rpc.Generated` => `./src/PACKAGE_NAME.Rpc.Generated` +- `./src/Apache.IoTDB.Rpc.Generated/Apache.IoTDB.Rpc.Generated.csproj` => `./src/PACKAGE_NAME.Rpc.Generated/PACKAGE_NAME.Rpc.Generated.csproj` Besides, you also need to modify the configuration in `./src/Apache.IoTDB/Apache.IoTDB.csproj` to ensure that the project references are correct. -``` xml + +```xml ``` + to -``` xml + +```xml ``` ### Step 2: Add package information + Modify `PACKAGE_NAME.csproj` to add package information, including version number, author, company, package description information, etc. - The commonly used ones are as follows, you can find a complete list in [NuGet pack and restore as MSBuild targets](https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#pack-target). +The commonly used ones are as follows, you can find a complete list in [NuGet pack and restore as MSBuild targets](https://docs.microsoft.com/en-us/nuget/reference/msbuild-targets#pack-target). -- `Version`, a specific version number in the form Major.Minor.Patch\[-Suffix\] where -Suffix identifies [pre-release versions](https://docs.microsoft.com/en-us/nuget/create-packages/prerelease-packages). If not specified, the default value is 1.0.0. -- `Authors`, author and owner information. If not specified, the default value is AssemblyName. -- `Company`, your company name. If not specified, the default value is AssemblyName. -- `PackageDescription`, A long description of the package for UI display. +- `Version`, a specific version number in the form Major.Minor.Patch\[-Suffix\] where -Suffix identifies [pre-release versions](https://docs.microsoft.com/en-us/nuget/create-packages/prerelease-packages). If not specified, the default value is 1.0.0. +- `Authors`, author and owner information. If not specified, the default value is AssemblyName. +- `Company`, your company name. If not specified, the default value is AssemblyName. +- `PackageDescription`, A long description of the package for UI display. -``` xml +```xml 0.12.4 Alice, Bob, Carol @@ -40,22 +48,27 @@ Modify `PACKAGE_NAME.csproj` to add package information, including version numbe ``` ### Step 3: Build package with dotnet pack + Execute the following commands in the same directory of `PACKAGE_NAME.csproj` and `PACKAGE_NAME.Rpc.Generated.csproj` to pack. You can find the generated package file `PACKAGE_NAME.VERSION.nupkg` in `bin/`. #### Debug -``` bash -dotnet pack PACKAGE_NAME.csproj --configuration debug + +```bash +dotnet pack PACKAGE_NAME.csproj --configuration debug ``` #### Release -``` bash -dotnet pack PACKAGE_NAME.csproj --configuration release + +```bash +dotnet pack PACKAGE_NAME.csproj --configuration release ``` ## Publish + ### Web portal: use the Upload Package tab on nuget.org + 1. Select Upload on the top menu of nuget.org and browse to the package location. -![](https://docs.microsoft.com/en-us/nuget/nuget-org/media/publish_uploadyourpackage.png) + ![](https://docs.microsoft.com/en-us/nuget/nuget-org/media/publish_uploadyourpackage.png) 2. nuget.org tells you if the package name is available. If it isn't, change the package identifier in your project, rebuild, and try the upload again. @@ -64,7 +77,9 @@ dotnet pack PACKAGE_NAME.csproj --configuration release 4. When all the information is ready, select the Submit button. ### Command line + #### Step 1: Sign in & Create API keys + 1. [Sign into your nuget.org](https://www.nuget.org/) account or create an account if you don't have one already. 2. Select your user name (on the upper right), then select **API Keys**. @@ -72,18 +87,21 @@ dotnet pack PACKAGE_NAME.csproj --configuration release 3. Select **Create**, provide a name for your key, select **Select Scopes > Push**. Enter **\*** for **Glob pattern**, then select **Create**. (See below for more about scopes.) 4. Once the key is created, select **Copy** to retrieve the access key you need in the CLI: -![](https://docs.microsoft.com/en-us/nuget/quickstart/media/qs_create-02-apikey.png) + ![](https://docs.microsoft.com/en-us/nuget/quickstart/media/qs_create-02-apikey.png) 5. **Important**: Save your key in a secure location because you cannot copy the key again later on. If you return to the API key page, you need to regenerate the key to copy it. You can also remove the API key if you no longer want to push packages via the CLI. #### Step 2: Publish with dotnet nuget push + 1. Change to the directory containing the `.nupkg` file (`bin/Debug/` or `bin/Release/`). 2. Execute the following command, specifying your package name and replacing the key value with your API key: -``` .NET CLI + +```.NET CLI dotnet nuget push PACKAGE_NAME.VERSION.nupkg --api-key YOUR_API_KEY --source https://api.nuget.org/v3/index.json ``` ## References + [MS Docs: Create a NuGet package](https://docs.microsoft.com/en-us/nuget/create-packages/creating-a-package-dotnet-cli) [MS Docs: Publishing packages](https://docs.microsoft.com/en-us/nuget/nuget-org/publish-a-package) From 39e89d403f9fb9f93c15953fff6d3d6c2badaff6 Mon Sep 17 00:00:00 2001 From: CritasWang Date: Wed, 7 Jan 2026 17:29:05 +0800 Subject: [PATCH 3/5] test --- .github/workflows/pre-commit-format.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pre-commit-format.yml b/.github/workflows/pre-commit-format.yml index a540aa1..b6d53e0 100644 --- a/.github/workflows/pre-commit-format.yml +++ b/.github/workflows/pre-commit-format.yml @@ -20,8 +20,6 @@ jobs: env: DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 DOTNET_CLI_TELEMETRY_OPTOUT: 1 - TMPDIR: ${{ runner.temp }} - DOTNET_CLI_HOME: ${{ runner.temp }}/dotnet-home steps: - uses: actions/checkout@v4 @@ -36,6 +34,11 @@ jobs: with: python-version: "3.10" + - name: Configure temp directories + run: | + echo "TMPDIR=${{ runner.temp }}/dotnet-tmp" >> "$GITHUB_ENV" + echo "DOTNET_CLI_HOME=${{ runner.temp }}/dotnet-home" >> "$GITHUB_ENV" + - name: Clean dotnet temporary folder run: | sudo rm -rf /tmp/.dotnet From 49548c5f15f31d4b56810478d60edb629ed7cde8 Mon Sep 17 00:00:00 2001 From: CritasWang Date: Wed, 7 Jan 2026 17:41:28 +0800 Subject: [PATCH 4/5] test --- .github/workflows/pre-commit-format.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pre-commit-format.yml b/.github/workflows/pre-commit-format.yml index b6d53e0..bea295c 100644 --- a/.github/workflows/pre-commit-format.yml +++ b/.github/workflows/pre-commit-format.yml @@ -38,12 +38,15 @@ jobs: run: | echo "TMPDIR=${{ runner.temp }}/dotnet-tmp" >> "$GITHUB_ENV" echo "DOTNET_CLI_HOME=${{ runner.temp }}/dotnet-home" >> "$GITHUB_ENV" + echo "XDG_RUNTIME_DIR=${{ runner.temp }}/xdg-runtime" >> "$GITHUB_ENV" + echo "NUGET_PACKAGES=${{ runner.temp }}/nuget-packages" >> "$GITHUB_ENV" - name: Clean dotnet temporary folder run: | sudo rm -rf /tmp/.dotnet - rm -rf "$TMPDIR/.dotnet" "$DOTNET_CLI_HOME" - mkdir -p "$TMPDIR/.dotnet" "$DOTNET_CLI_HOME" + rm -rf "$TMPDIR/.dotnet" "$DOTNET_CLI_HOME" "$XDG_RUNTIME_DIR" "$NUGET_PACKAGES" + mkdir -p "$TMPDIR/.dotnet" "$DOTNET_CLI_HOME" "$XDG_RUNTIME_DIR" "$NUGET_PACKAGES" + chmod 700 "$XDG_RUNTIME_DIR" - name: Install pre-commit and dependencies run: | From 20e72a56665bf2cf3fa66d45de4989a64282c234 Mon Sep 17 00:00:00 2001 From: CritasWang Date: Wed, 7 Jan 2026 17:48:22 +0800 Subject: [PATCH 5/5] fix --- .github/workflows/pre-commit-format.yml | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/.github/workflows/pre-commit-format.yml b/.github/workflows/pre-commit-format.yml index bea295c..3b7589c 100644 --- a/.github/workflows/pre-commit-format.yml +++ b/.github/workflows/pre-commit-format.yml @@ -34,19 +34,11 @@ jobs: with: python-version: "3.10" - - name: Configure temp directories - run: | - echo "TMPDIR=${{ runner.temp }}/dotnet-tmp" >> "$GITHUB_ENV" - echo "DOTNET_CLI_HOME=${{ runner.temp }}/dotnet-home" >> "$GITHUB_ENV" - echo "XDG_RUNTIME_DIR=${{ runner.temp }}/xdg-runtime" >> "$GITHUB_ENV" - echo "NUGET_PACKAGES=${{ runner.temp }}/nuget-packages" >> "$GITHUB_ENV" - - name: Clean dotnet temporary folder run: | sudo rm -rf /tmp/.dotnet - rm -rf "$TMPDIR/.dotnet" "$DOTNET_CLI_HOME" "$XDG_RUNTIME_DIR" "$NUGET_PACKAGES" - mkdir -p "$TMPDIR/.dotnet" "$DOTNET_CLI_HOME" "$XDG_RUNTIME_DIR" "$NUGET_PACKAGES" - chmod 700 "$XDG_RUNTIME_DIR" + mkdir -p ${{ runner.temp }}/dotnet-home + mkdir -p ${{ runner.temp }}/xdg-runtime - name: Install pre-commit and dependencies run: | @@ -54,5 +46,10 @@ jobs: pre-commit install-hooks - name: Run pre-commit checks + env: + TMPDIR: ${{ runner.temp }} + DOTNET_CLI_HOME: ${{ runner.temp }}/dotnet-home + XDG_RUNTIME_DIR: ${{ runner.temp }}/xdg-runtime + NUGET_PACKAGES: ${{ runner. temp }}/nuget-packages run: | pre-commit run --all-files