Skip to content

Commit

Permalink
feat: added support for packages input
Browse files Browse the repository at this point in the history
  • Loading branch information
jbristowe committed Sep 15, 2021
1 parent a2f7191 commit 2bf1c08
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -81,6 +81,7 @@ The following inputs are optional:
| `no_deploy_after` | Time at which scheduled deployment should expire, specified as any valid DateTimeOffset format, and assuming the time zone is the current local time zone. | |
| `no_raw_log` | Print the raw log of failed tasks. | `false` |
| `package` | The version number to use for a package in the release (format: `StepName:Version`, `PackageID:Version`, or `StepName:PackageName:Version`). | |
| `packages` | Multi-line list of version numbers to use for a package in the release (format: `StepName:Version`, `PackageID:Version`, or `StepName:PackageName:Version`). | |
| `package_prerelease` | Pre-release for latest version of all packages to use for this release. | |
| `package_version` | The version number of all packages to use for this release. | |
| `packages_folder` | The folder designated for containing packages. | |
Expand Down
6 changes: 4 additions & 2 deletions action.yml
@@ -1,7 +1,7 @@
name: 'Create Release in Octopus Deploy'
description: 'GitHub Action to create a release in Octopus Deploy'
author: 'Octopus Deploy'
branding:
branding:
color: 'blue'
icon: 'package'

Expand Down Expand Up @@ -69,6 +69,8 @@ inputs:
description: 'Pre-release for latest version of all packages to use for this release.'
package_version:
description: 'The version number of all packages to use for this release.'
packages:
description: 'A multi-line list of version numbers to use for a package in the release. Format: StepName:Version or PackageID:Version or StepName:PackageName:Version. StepName, PackageID, and PackageName can be replaced with an asterisk ("*"). An asterisk will be assumed for StepName, PackageID, or PackageName if they are omitted.'
packages_folder:
description: 'The folder designated for containing packages.'
password:
Expand Down Expand Up @@ -120,4 +122,4 @@ inputs:

runs:
using: 'node12'
main: 'dist/index.js'
main: 'dist/index.js'
8 changes: 5 additions & 3 deletions src/create-release.ts
@@ -1,6 +1,6 @@
import {ExecOptions, exec} from '@actions/exec'
import {info, setFailed} from '@actions/core'
import {InputParameters} from './input-parameters'
import { ExecOptions, exec } from '@actions/exec'
import { info, setFailed } from '@actions/core'
import { InputParameters } from './input-parameters'

function getArgs(parameters: InputParameters): string[] {
info('🔣 Parsing inputs...')
Expand Down Expand Up @@ -49,6 +49,8 @@ function getArgs(parameters: InputParameters): string[] {
if (parameters.noRawLog) args.push(`--noRawLog`)
if (parameters.package.length > 0)
args.push(`--package=${parameters.package}`)
if (parameters.packages.length > 0)
parameters.packages.map(p => args.push(`--package=${p}`))
if (parameters.packagePrerelease.length > 0)
args.push(`--packagePrerelease=${parameters.packagePrerelease}`)
if (parameters.packageVersion.length > 0)
Expand Down
4 changes: 3 additions & 1 deletion src/input-parameters.ts
@@ -1,4 +1,4 @@
import {getBooleanInput, getInput} from '@actions/core'
import {getBooleanInput, getInput, getMultilineInput} from '@actions/core'

export interface InputParameters {
apiKey: string
Expand All @@ -25,6 +25,7 @@ export interface InputParameters {
noRawLog: boolean
package: string
packagePrerelease: string
packages: string[]
packageVersion: string
packagesFolder: string
password: string
Expand Down Expand Up @@ -75,6 +76,7 @@ export function get(): InputParameters {
noDeployAfter: getInput('no_deploy_after'),
noRawLog: getBooleanInput('no_raw_log'),
package: getInput('package'),
packages: getMultilineInput('packages'),
packagePrerelease: getInput('package_prerelease'),
packageVersion: getInput('package_version'),
packagesFolder: getInput('packages_folder'),
Expand Down

0 comments on commit 2bf1c08

Please sign in to comment.