Skip to content

Commit

Permalink
Update create-release.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
jbristowe committed Mar 24, 2021
1 parent 3c941fd commit 75c6832
Showing 1 changed file with 39 additions and 20 deletions.
59 changes: 39 additions & 20 deletions src/create-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,32 +93,51 @@ export async function createRelease(
): Promise<void> {
const args = getArgs(parameters)

let stdout = ''

const options: exec.ExecOptions = {
listeners: {
stdline: (data: string) => {
if (data.includes(' created successfully!')) {
core.info(`🎉 ${data}`)
return
}

if (data.includes('Octopus Deploy Command Line Tool')) {
const version = data.split('version ')[1]
core.info(`🐙 Using Octopus Deploy CLI ${version}...`)
return
}

switch (data) {
case 'Creating release...':
core.info('🐙 Creating a release in Octopus Deploy...')
break
default:
core.info(`${data}`)
break
}
stdout: (data: Buffer) => {
stdout += data.toString()
}
},
silent: true
}

await exec.exec('octo', args, options)

const lines = stdout.split(/\r?\n/)
for (const line of lines) {
if (line.length <= 0) continue

if (line.includes('Octopus Deploy Command Line Tool')) {
const version = line.split('version ')[1]
core.info(`🐙 Using Octopus Deploy CLI ${version}...`)
continue
}

if (line.includes('Handshaking with Octopus Server')) {
core.info(`🤝 Handshaking with Octopus Deploy`)
continue
}

if (line.includes('Authenticated as:')) {
core.info(`✅ Authenticated`)
continue
}

if (line.includes(' created successfully!')) {
core.info(`🎉 ${line}`)
continue
}

switch (line) {
case 'Creating release...':
core.info('🐙 Creating a release in Octopus Deploy...')
break
default:
core.info(`${line}`)
break
}
}
}

0 comments on commit 75c6832

Please sign in to comment.