From 2512dd42de300fdee042e9e550b70d50b290e5b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20J=C3=B6rg?= Date: Thu, 5 Feb 2026 19:10:55 +0100 Subject: [PATCH] fix: Add default dotnet-sdk --- publish-nuget/action.yaml | 57 ++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/publish-nuget/action.yaml b/publish-nuget/action.yaml index 3005cd4..74d0b2e 100644 --- a/publish-nuget/action.yaml +++ b/publish-nuget/action.yaml @@ -11,6 +11,10 @@ inputs: nuget-key: description: "API key with which to authenticate to the NuGet registry." required: true + dotnet-sdk: + description: "Nix dotnet SDK package to use (e.g. dotnet-sdk_10, dotnet-sdk_9)" + required: false + default: "dotnet-sdk_10" registry: description: "Gitea registry domain, e.g. git.oceanbox.io" required: true @@ -49,36 +53,59 @@ runs: - name: Prep NuGet source shell: bash run: | - nix-shell --run 'set -o pipefail; set -o nounset; set -o errexit; - dotnet nuget remove source gitea 2>&1 > /dev/null || true - dotnet nuget add source --name ${{ inputs.source-name }} "https://${{ inputs.registry }}/api/packages/${{ inputs.registry-owner }}/nuget/index.json"' + nix-shell -p ${{ inputs.dotnet-sdk }} --run ' + set -euo pipefail + dotnet nuget add source \ + --name "${{ inputs.source-name }}" \ + "https://${{ inputs.registry }}/api/packages/${{ inputs.registry-owner }}/nuget/index.json" + ' - name: Restore dependencies shell: bash run: | - nix-shell --run "set -o pipefail; set -o nounset; set -o errexit; - dotnet restore ${{ inputs.package-path }} ${{ inputs.dotnet-restore-args }}" + nix-shell -p ${{ inputs.dotnet-sdk }} --run ' + set -euo pipefail + dotnet restore "${{ inputs.package-path }}" ${{ inputs.dotnet-restore-args }} + ' - name: Build shell: bash run: | - nix-shell --run "set -o pipefail; set -o nounset; set -o errexit; - dotnet build --no-restore --configuration ${{ inputs.configuration }} ${{ inputs.package-path }} ${{ inputs.dotnet-build-args }}" + nix-shell -p ${{ inputs.dotnet-sdk }} --run ' + set -euo pipefail + dotnet build \ + --no-restore \ + --configuration "${{ inputs.configuration }}" \ + "${{ inputs.package-path }}" \ + ${{ inputs.dotnet-build-args }} + ' - name: Pack shell: bash run: | - nix-shell --run "set -o pipefail; set -o nounset; set -o errexit; - dotnet pack ${{ inputs.package-path }} --no-restore ${{ inputs.dotnet-pack-args }} --configuration ${{ inputs.configuration }} -o ${{ inputs.nupkg-dir }}" + nix-shell -p ${{ inputs.dotnet-sdk }} --run ' + set -euo pipefail + dotnet pack \ + "${{ inputs.package-path }}" \ + --no-restore \ + --configuration "${{ inputs.configuration }}" \ + -o "${{ inputs.nupkg-dir }}" \ + ${{ inputs.dotnet-pack-args }} + ' - name: Publish NuGet package shell: bash run: | - nix-shell --run "set -o pipefail; set -o nounset; set -o errexit; - dotnet nuget push ${{ inputs.nupkg-dir }}/${{ inputs.package-name }}.*.nupkg --api-key ${{ inputs.nuget-key }} --source '${{ inputs.source-name }}' --skip-duplicate" - + nix-shell -p ${{ inputs.dotnet-sdk }} --run ' + set -euo pipefail + dotnet nuget push \ + "${{ inputs.nupkg-dir }}/${{ inputs.package-name }}.*.nupkg" \ + --api-key "${{ inputs.nuget-key }}" \ + --source "${{ inputs.source-name }}" \ + --skip-duplicate + ' # TODO: Add attestation # - name: Attest Build Provenance - # uses: actions/attest-build-provenance@v1 - # with: - # subject-path: ${{ inputs.nupkg-dir }}/${{ inputs.package-path }}.*.nupkg + # uses: actions/attest-build-provenance@v1 + # with: + # subject-path: ${{ inputs.nupkg-dir }}/${{ inputs.package-path }}.*.nupkg