Add support for certificate authentication #29
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI / CD | |
| on: | |
| push: | |
| branches: [ "**" ] | |
| tags: [ "v*" ] | |
| pull_request: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build_and_test: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: src | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET 10 | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: "10.0.x" | |
| - name: Check formatting | |
| run: dotnet format --verify-no-changes | |
| - name: Restore | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build --configuration Release --no-restore | |
| publish_nuget: | |
| name: Publish to NuGet (tagged releases) | |
| needs: build_and_test | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| defaults: | |
| run: | |
| working-directory: src | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET 10 | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: "10.0.x" | |
| - name: Compute version from tag | |
| id: version | |
| shell: bash | |
| run: | | |
| TAG="${GITHUB_REF_NAME}" | |
| VERSION="${TAG#v}" | |
| if [[ "$VERSION" == "$TAG" ]]; then | |
| echo "Expected tag to start with 'v' (e.g. v1.2.3) but got: $TAG" >&2 | |
| exit 1 | |
| fi | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Restore | |
| run: dotnet restore | |
| - name: Pack (version from tag) | |
| run: dotnet pack --configuration Release --no-restore -o ../artifacts /p:PackageVersion=${{ steps.version.outputs.version }} | |
| - name: Publish to nuget.org | |
| run: dotnet nuget push "../artifacts/*.nupkg" --api-key "${NUGET_API_KEY}" --source "https://api.nuget.org/v3/index.json" --skip-duplicate | |
| env: | |
| NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} |