This is an automated email from the ASF dual-hosted git repository. chaokunyang pushed a commit to tag v0.17.0 in repository https://gitbox.apache.org/repos/asf/fory.git
commit ddae0e3cf98a693b7a8a3e0680212c63493d11f2 Author: chaokunyang <[email protected]> AuthorDate: Sun Apr 19 20:11:40 2026 +0800 add release-csharp.yaml --- .github/workflows/release-csharp.yaml | 147 ++++++++++++++++++++++++++++++++++ 1 file changed, 147 insertions(+) diff --git a/.github/workflows/release-csharp.yaml b/.github/workflows/release-csharp.yaml new file mode 100644 index 000000000..8d5c7ea1a --- /dev/null +++ b/.github/workflows/release-csharp.yaml @@ -0,0 +1,147 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: Publish C# +run-name: "C# Release: ${{ github.ref_name }}" + +on: + push: + tags: ['v*'] + +permissions: + contents: read + id-token: write + +concurrency: + group: release-csharp-${{ github.ref }} + cancel-in-progress: false + +jobs: + publish-csharp: + runs-on: ubuntu-latest + if: github.repository == 'apache/fory' + env: + NUGET_SOURCE: https://api.nuget.org/v3/index.json + NUGET_USER: ${{ vars.NUGET_USER || secrets.NUGET_USER }} + steps: + - uses: actions/checkout@v5 + + - uses: actions/setup-python@v5 + with: + python-version: '3.11' + cache: 'pip' + + - name: Bump C# version + shell: bash + run: | + set -euo pipefail + VERSION="${{ github.ref_name }}" + VERSION="${VERSION#v}" + python ci/release.py bump_version -l csharp -version "$VERSION" + + - name: Set up .NET 8 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: "8.0.x" + cache: true + cache-dependency-path: | + csharp/**/*.csproj + csharp/Fory.sln + + - name: Restore C# dependencies + shell: bash + working-directory: csharp + run: | + set -euo pipefail + dotnet restore Fory.sln + + - name: Build C# solution + shell: bash + working-directory: csharp + run: | + set -euo pipefail + dotnet build Fory.sln -c Release --no-restore + + - name: Run C# tests + shell: bash + working-directory: csharp + run: | + set -euo pipefail + dotnet test Fory.sln -c Release --no-build + + - name: Pack Apache.Fory + shell: bash + working-directory: csharp + run: | + set -euo pipefail + rm -rf artifacts/nuget + mkdir -p artifacts/nuget + dotnet pack src/Fory/Fory.csproj \ + -c Release \ + --no-restore \ + -o artifacts/nuget \ + -p:ContinuousIntegrationBuild=true + + - name: Verify packed artifacts + shell: bash + working-directory: csharp + run: | + set -euo pipefail + VERSION="${{ github.ref_name }}" + VERSION="${VERSION#v}" + test -f "artifacts/nuget/Apache.Fory.$VERSION.nupkg" + test -f "artifacts/nuget/Apache.Fory.$VERSION.snupkg" + ls -l artifacts/nuget + + - name: Validate NuGet trusted publishing user + shell: bash + run: | + set -euo pipefail + if [[ -z "${NUGET_USER}" ]]; then + echo "Set repository variable or secret NUGET_USER to the nuget.org profile name used for trusted publishing." >&2 + exit 1 + fi + + - name: NuGet login (OIDC -> temp API key) + uses: NuGet/login@v1 + id: login + with: + user: ${{ env.NUGET_USER }} + + - name: Publish Apache.Fory package + shell: bash + working-directory: csharp + run: | + set -euo pipefail + VERSION="${{ github.ref_name }}" + VERSION="${VERSION#v}" + dotnet nuget push "artifacts/nuget/Apache.Fory.$VERSION.nupkg" \ + --api-key "${{ steps.login.outputs.NUGET_API_KEY }}" \ + --source "$NUGET_SOURCE" \ + --skip-duplicate + + - name: Publish Apache.Fory symbols + shell: bash + working-directory: csharp + run: | + set -euo pipefail + VERSION="${{ github.ref_name }}" + VERSION="${VERSION#v}" + dotnet nuget push "artifacts/nuget/Apache.Fory.$VERSION.snupkg" \ + --api-key "${{ steps.login.outputs.NUGET_API_KEY }}" \ + --source "$NUGET_SOURCE" \ + --skip-duplicate --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
