fix: Add default dotnet-sdk

This commit is contained in:
2026-02-05 19:10:55 +01:00
parent 93a3dc9fdf
commit 2512dd42de
+42 -15
View File
@@ -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