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: nuget-key:
description: "API key with which to authenticate to the NuGet registry." description: "API key with which to authenticate to the NuGet registry."
required: true 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: registry:
description: "Gitea registry domain, e.g. git.oceanbox.io" description: "Gitea registry domain, e.g. git.oceanbox.io"
required: true required: true
@@ -49,36 +53,59 @@ runs:
- name: Prep NuGet source - name: Prep NuGet source
shell: bash shell: bash
run: | run: |
nix-shell --run 'set -o pipefail; set -o nounset; set -o errexit; nix-shell -p ${{ inputs.dotnet-sdk }} --run '
dotnet nuget remove source gitea 2>&1 > /dev/null || true set -euo pipefail
dotnet nuget add source --name ${{ inputs.source-name }} "https://${{ inputs.registry }}/api/packages/${{ inputs.registry-owner }}/nuget/index.json"' dotnet nuget add source \
--name "${{ inputs.source-name }}" \
"https://${{ inputs.registry }}/api/packages/${{ inputs.registry-owner }}/nuget/index.json"
'
- name: Restore dependencies - name: Restore dependencies
shell: bash shell: bash
run: | run: |
nix-shell --run "set -o pipefail; set -o nounset; set -o errexit; nix-shell -p ${{ inputs.dotnet-sdk }} --run '
dotnet restore ${{ inputs.package-path }} ${{ inputs.dotnet-restore-args }}" set -euo pipefail
dotnet restore "${{ inputs.package-path }}" ${{ inputs.dotnet-restore-args }}
'
- name: Build - name: Build
shell: bash shell: bash
run: | run: |
nix-shell --run "set -o pipefail; set -o nounset; set -o errexit; nix-shell -p ${{ inputs.dotnet-sdk }} --run '
dotnet build --no-restore --configuration ${{ inputs.configuration }} ${{ inputs.package-path }} ${{ inputs.dotnet-build-args }}" set -euo pipefail
dotnet build \
--no-restore \
--configuration "${{ inputs.configuration }}" \
"${{ inputs.package-path }}" \
${{ inputs.dotnet-build-args }}
'
- name: Pack - name: Pack
shell: bash shell: bash
run: | run: |
nix-shell --run "set -o pipefail; set -o nounset; set -o errexit; nix-shell -p ${{ inputs.dotnet-sdk }} --run '
dotnet pack ${{ inputs.package-path }} --no-restore ${{ inputs.dotnet-pack-args }} --configuration ${{ inputs.configuration }} -o ${{ inputs.nupkg-dir }}" 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 - name: Publish NuGet package
shell: bash shell: bash
run: | run: |
nix-shell --run "set -o pipefail; set -o nounset; set -o errexit; nix-shell -p ${{ inputs.dotnet-sdk }} --run '
dotnet nuget push ${{ inputs.nupkg-dir }}/${{ inputs.package-name }}.*.nupkg --api-key ${{ inputs.nuget-key }} --source '${{ inputs.source-name }}' --skip-duplicate" 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 # TODO: Add attestation
# - name: Attest Build Provenance # - name: Attest Build Provenance
# uses: actions/attest-build-provenance@v1 # uses: actions/attest-build-provenance@v1
# with: # with:
# subject-path: ${{ inputs.nupkg-dir }}/${{ inputs.package-path }}.*.nupkg # subject-path: ${{ inputs.nupkg-dir }}/${{ inputs.package-path }}.*.nupkg