name: tpl-to-nupkg
description: "Pack a .nupkg given a .nuspec Go template file and a yaml input file. The input yaml file environment variables replaced first."
inputs:
  template:
    description: "Template or local path of the template file to use. Defaults to the template file in the action's directory."
    required: false
  input:
    description: "Input or local path of the yaml input data file."
    required: true
  version:
    description: "Version of the .nupkg file."
    required: true
  outputDirectory:
    description: "Directory for the output file."
    required: true
    default: '.'
  nuspecExtension:
    description: "Extension for the output file."
    required: false
    default: .nuspec
  tmpDir:
    description: "Temporary directory. Default: _tmp"
    required: true
    default: _tmp
outputs:
  nuspec:
    description: "The generated output .nuspec file."
    value: ${{ steps.template.outputs.result }}
  nupkg:
    description: "The generated output .nupkg file."
    value: ${{ inputs.outputDirectory }}/${{ steps.nuspec.outputs.packageName }}.${{ inputs.version }}.nupkg
  nupkgName:
    description: "The generated output .nupkg file's name."
    value: ${{ steps.nuspec.outputs.packageName }}.${{ inputs.version }}.nupkg
runs:
  using: "composite"
  steps:
  - name: "Generate Nuspec From Template"
    id: nuspec
    uses: act/common/tpl/tpl-to-nuspec@master
    with:
      template: ${{ inputs.template }}
      input: ${{ inputs.input }}
  - name: "Build the .nupkg file."
    uses: act/common/nuget/nuget-pack@master
    with:
      nuspec: ${{ steps.nuspec.outputs.nuspec }}
      version: ${{ inputs.version }}
      outputDirectory: ${{ inputs.outputDirectory }}
  