Skip to content

Commit

Permalink
Merge pull request #2 from duckie-team/develop
Browse files Browse the repository at this point in the history
update
  • Loading branch information
jisungbin authored Oct 21, 2022
2 parents 96da4bc + 37ec5cf commit 55ff72b
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 10 deletions.
18 changes: 9 additions & 9 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ inputs:
description: '해당 PR 에 설정된 label'
required: true

# outputs:
# bump_type:
# description: 'Bump 할 버전'
# release_target:
# description: 'Release 할 대상'
# publish_module_id:
# description: 'Publish 할 모듈명'
# is_snapshot:
# description: '스냅샷 배포인지 여부'
outputs:
bump_type:
description: 'Bump 할 버전'
release_target:
description: 'Release 할 대상'
publish_module_id:
description: 'Publish 할 모듈명'
is_snapshot:
description: '스냅샷 배포인지 여부'

runs:
using: 'node16'
Expand Down
53 changes: 52 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,59 @@
const core = require('@actions/core')

try {
const labels = core.getInput('labels')
const rawLabel = core.getInput('labels')
// const rawLabel = `[
// "ReleaseTarget_UiComponents",
// "BumpType_Major",
// "publish"
// ]`

const labels = rawLabel.substring(1, rawLabel.length - 2).
replace(/[\n"]/gi, '').
split(',').
map(label => label.trim())
console.log(`Input labels: ${labels}`)

// starts with BumpType_
let bump_type = labels.find(label => label.startsWith('BumpType_'))
if (bump_type !== undefined) {
bump_type = bump_type.split('_')[1]
}
console.log(`Bump type: ${bump_type}`)
core.setOutput('bump_type', bump_type)

// starts with ReleaseTarget_
let release_target = labels.find(label => label.startsWith('ReleaseTarget_'))
if (release_target !== undefined) {
release_target = release_target.split('_')[1]
}
console.log(`Release target: ${release_target}`)
core.setOutput('release_target', release_target)

let publish_module_id
switch (release_target) {
case 'LintCore':
publish_module_id = ':lint-core-publish'
break
case 'LintQuack':
publish_module_id = ':lint-quack-publish'
break
case 'LintCompose':
publish_module_id = ':lint-compose-publish'
break
case 'LintWriting':
publish_module_id = ':lint-writing-publish'
break
case 'UiComponents':
publish_module_id = ':ui-components'
break
}
console.log(`Publish module id: ${publish_module_id}`)
core.setOutput('publish_module_id', publish_module_id)

const is_snapshot = labels.indexOf('publish') === -1
console.log(`Is snapshot: ${is_snapshot}`)
core.setOutput('is_snapshot', is_snapshot)
} catch (error) {
core.setFailed(error.message)
}

0 comments on commit 55ff72b

Please sign in to comment.