80 lines
2.5 KiB
YAML
80 lines
2.5 KiB
YAML
name: nuget-build-and-compare
|
|
description: "Pack a .nuspec file into a .nupkg."
|
|
inputs:
|
|
name:
|
|
description: "The name of the package."
|
|
required: true
|
|
input:
|
|
description: "The json input which will be converted into yaml."
|
|
required: true
|
|
defaultVersion:
|
|
description: "Version of the .nupkg file."
|
|
required: true
|
|
default: 1.0.0
|
|
outputDirectory:
|
|
description: "Directory for the output .nupkg."
|
|
required: true
|
|
url:
|
|
description: "Url of the GitHub server instance."
|
|
required: true
|
|
default: ${{ github.server_url }}
|
|
organization:
|
|
description: "Organization to search."
|
|
required: true
|
|
default: ${{ github.repository_owner }}
|
|
username:
|
|
description: "Username for the nuget repository to search."
|
|
required: true
|
|
default: ${{ github.actor }}
|
|
password:
|
|
description: "Password or ApiKey of the nuget repository to search."
|
|
required: true
|
|
default: ${{ github.token }}
|
|
outputs:
|
|
nupkg:
|
|
description: "The generated output .nupkg file."
|
|
value: ${{ steps.package.outputs.nupkg }}
|
|
nupkgName:
|
|
description: "The generated output .nupkg file's name."
|
|
value: ${{ steps.package.outputs.nupkgName }}
|
|
hasChanged:
|
|
description: "Whether or not the .nupkg files match."
|
|
value: ${{ steps.compare.outputs.success != 'true' }}
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: "Get the next version of the package."
|
|
uses: act/common/nuget/nuget-get-next-branched-version@master
|
|
id: nuget
|
|
with:
|
|
name: ${{ inputs.name }}
|
|
defaultVersion: ${{ inputs.defaultVersion }}
|
|
url: ${{ inputs.url }}
|
|
organization: ${{ inputs.organization }}
|
|
apiToken: ${{ inputs.password }}
|
|
- name: "Get yaml from json."
|
|
id: convert
|
|
uses: act/common/yq/yq-convert@master
|
|
with:
|
|
from: json
|
|
to: yaml
|
|
input: ${{ inputs.input }}
|
|
- name: "Build .nupkg."
|
|
id: package
|
|
uses: act/common/tpl/tpl-to-nupkg@master
|
|
with:
|
|
input: ${{ steps.convert.outputs.result }}
|
|
version: ${{ steps.nuget.outputs.nextVersion }}
|
|
outputDirectory: ${{ inputs.outputDirectory }}
|
|
- name: "Compare .nupkg to remote .nupkg."
|
|
if: ${{ steps.nuget.outputs.latestVersion }}
|
|
id: compare
|
|
uses: act/common/nuget/nuget-compare-version@master
|
|
with:
|
|
lhs: ${{ steps.package.outputs.nupkg }}
|
|
version: ${{ steps.nuget.outputs.latestVersion }}
|
|
name: ${{ inputs.name }}
|
|
username: ${{ inputs.username }}
|
|
password: ${{ inputs.password }}
|
|
url: ${{ inputs.url }}/_registry/nuget/${{ inputs.organization }}/index.json
|