72 lines
2.6 KiB
YAML
72 lines
2.6 KiB
YAML
name: nuget-get-next-branched-version
|
|
description: "Get the next version of a NuGet package based on the current branch status."
|
|
inputs:
|
|
name:
|
|
description: "The name of the package."
|
|
required: true
|
|
defaultVersion:
|
|
description: "Default version to use."
|
|
required: true
|
|
default: 1.0.0
|
|
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 }}
|
|
apiToken:
|
|
description: "Api Token for GitHub."
|
|
required: true
|
|
default: ${{ github.token }}
|
|
prerelease:
|
|
description: "Query prerelease packages. Values: true, false."
|
|
required: false
|
|
default: "${{ github.event_name == 'pull_request' }}"
|
|
incrementMode:
|
|
description: "The mode to increment by. Options: 'default', 'major', 'minor', 'patch', 'revision'"
|
|
required: false
|
|
default: revision
|
|
outputs:
|
|
latestVersion:
|
|
description: "The current latest version for the .nupkg."
|
|
value: ${{ steps.nuget.outputs.version || steps.nugetFallback.outputs.version }}
|
|
nextVersion:
|
|
description: "The next version for the .nupkg file."
|
|
value: ${{ steps.version.outputs.nextVersion }}
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: "Get the base version for the package."
|
|
uses: act/common/utils/version-increment-branch@master
|
|
id: base
|
|
with:
|
|
version: ${{ inputs.defaultVersion }}
|
|
- uses: act/common/github/github-query-nuget-versions-latest@master
|
|
id: nuget
|
|
with:
|
|
name: ${{ inputs.name }}
|
|
url: ${{ inputs.url }}
|
|
organization: ${{ inputs.organization }}
|
|
apiToken: ${{ inputs.apiToken }}
|
|
filter: ^${{ steps.base.outputs.baseVersion }}
|
|
prerelease: ${{ inputs.prerelease }}
|
|
- name: "If no version is found, get the latest version for the package if we didn't already look for it."
|
|
uses: act/common/github/github-query-nuget-versions-latest@master
|
|
id: nugetFallback
|
|
if: ${{ steps.nuget.outputs.version == '' && inputs.prerelease != 'false' }}
|
|
with:
|
|
name: ${{ inputs.name }}
|
|
url: ${{ inputs.url }}
|
|
organization: ${{ inputs.organization }}
|
|
apiToken: ${{ inputs.apiToken }}
|
|
filter: ^${{ steps.base.outputs.majorMinorPatchVersion }}
|
|
prerelease: false
|
|
- name: "Get the next version for the package."
|
|
uses: act/common/utils/version-increment-branch@master
|
|
id: version
|
|
with:
|
|
incrementMode: ${{ inputs.incrementMode }}
|
|
version: ${{ steps.nuget.outputs.version || steps.nugetFallback.outputs.version || inputs.defaultVersion }}
|