fix: Avoid scripts for now
This commit is contained in:
+60
-27
@@ -2,46 +2,79 @@
|
||||
name: "publish-nuget"
|
||||
description: "Publishes a NuGet package to a Gitea-hosted NuGet registry and attests to its contents."
|
||||
inputs:
|
||||
package-name:
|
||||
description: "Name of the NuGet package, e.g. Oceanbox.FvcomKit."
|
||||
package-path:
|
||||
description: "Path to the package directory relative to src/, e.g. Oceanbox.FvcomKit"
|
||||
required: true
|
||||
nuget-key:
|
||||
description: "API key with which to authenticate to the NuGet registry."
|
||||
required: true
|
||||
nupkg-dir:
|
||||
description: |
|
||||
Directory in which to find the NuGet .nupkg file. We will search one level deep inside this directory for nupkg files named {package-name}.{any-string}.nupkg.
|
||||
Note that this action is not designed to work if you have two .nupkg files inside this directory, one called Foo.0.0.0.nupkg and one called Foo.Bar.0.0.0.nupkg;
|
||||
you should make sure there's only one package in this directory.
|
||||
registry:
|
||||
description: "Gitea registry domain, e.g. git.oceanbox.io"
|
||||
required: true
|
||||
registry-url:
|
||||
description: "URL of the NuGet registry, e.g. https://git.oceanbox.io/api/packages/oceanbox/nuget/index.json"
|
||||
default: "git.oceanbox.io"
|
||||
registry-owner:
|
||||
description: "Registry owner/organization name, e.g. oceanbox"
|
||||
required: true
|
||||
default: "https://git.oceanbox.io/api/packages/oceanbox/nuget/index.json"
|
||||
default: "oceanbox"
|
||||
source-name:
|
||||
description: "Name to use for the NuGet source when adding it."
|
||||
required: false
|
||||
default: "gitea-nuget"
|
||||
dotnet:
|
||||
description: "Path to the `dotnet` executable, if you want to override the default (e.g. because you wish to operate inside a Nix devshell)."
|
||||
nupkg-dir:
|
||||
description: "Directory where .nupkg files will be output"
|
||||
required: false
|
||||
default: "dotnet"
|
||||
skip-duplicate:
|
||||
description: 'If set to "true", skips publishing if the package version already exists.'
|
||||
default: "./nupkgs"
|
||||
configuration:
|
||||
description: "Build configuration (Release or Debug)"
|
||||
required: false
|
||||
default: "true"
|
||||
default: "Release"
|
||||
dotnet-restore-args:
|
||||
description: "Additional arguments to pass to dotnet restore"
|
||||
required: false
|
||||
default: ""
|
||||
dotnet-build-args:
|
||||
description: "Additional arguments to pass to dotnet build"
|
||||
required: false
|
||||
default: ""
|
||||
dotnet-pack-args:
|
||||
description: "Additional arguments to pass to dotnet pack"
|
||||
required: false
|
||||
default: "-p:TargetsForTfmSpecificContentInPackage="
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Publish to NuGet Registry
|
||||
- name: Prep NuGet source
|
||||
shell: bash
|
||||
id: publish-success
|
||||
env:
|
||||
NUGET_API_KEY: ${{ inputs.nuget-key }}
|
||||
PACKAGE_DIR: ${{ inputs.nupkg-dir }}
|
||||
PACKAGE_NAME: ${{ inputs.package-name }}
|
||||
DOTNET_EXE: ${{ inputs.dotnet }}
|
||||
REGISTRY_URL: ${{ inputs.registry-url }}
|
||||
SOURCE_NAME: ${{ inputs.source-name }}
|
||||
SKIP_DUPLICATE: ${{ inputs.skip-duplicate }}
|
||||
run: '$GITHUB_ACTION_PATH/nuget_push.sh "$PACKAGE_DIR"/"$PACKAGE_NAME".*.nupkg'
|
||||
run: |
|
||||
nix-shell --run 'set -o pipefail; set -o nounset; set -o errexit;
|
||||
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 src/${{ 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 }} src/${{ 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 src/${{ inputs.package-path }} --no-restore ${{ inputs.dotnet-pack-args }} --configuration ${{ inputs.configuration }} -o ${{ inputs.nupkg-dir }}"
|
||||
|
||||
- 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-path }}.*.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
|
||||
|
||||
Reference in New Issue
Block a user