Skip to content

Commit

Permalink
Add bake-target input (#69)
Browse files Browse the repository at this point in the history
Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
crazy-max and crazy-max committed Apr 29, 2021
1 parent ae43117 commit 72e5d60
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -271,6 +271,7 @@ Following inputs can be used as `step.with` keys
| `labels` | List | List of custom labels |
| `sep-tags` | String | Separator to use for tags output (default `\n`) |
| `sep-labels` | String | Separator to use for labels output (default `\n`) |
| `bake-target` | String | Bake target name (default `ghaction-docker-meta`) |
### outputs
Expand Down
5 changes: 3 additions & 2 deletions __tests__/meta.test.ts
Expand Up @@ -2392,11 +2392,12 @@ describe('bake', () => {
`type=raw,my`,
`type=raw,custom`,
`type=raw,tags`
]
],
bakeTarget: "meta"
} as Inputs,
{
"target": {
"ghaction-docker-meta": {
"meta": {
"tags": [
"user/app:release1",
"user/app:my",
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Expand Up @@ -25,6 +25,9 @@ inputs:
sep-labels:
description: 'Separator to use for labels output (default \n)'
required: false
bake-target:
description: 'Bake target name (default ghaction-docker-meta)'
required: false
github-token:
description: 'GitHub Token as provided by secrets'
default: ${{ github.token }}
Expand Down
3 changes: 2 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/context.ts
Expand Up @@ -14,6 +14,7 @@ export interface Inputs {
labels: string[];
sepTags: string;
sepLabels: string;
bakeTarget: string;
githubToken: string;
}

Expand All @@ -32,6 +33,7 @@ export function getInputs(): Inputs {
labels: getInputList('labels', true),
sepTags: core.getInput('sep-tags') || `\n`,
sepLabels: core.getInput('sep-labels') || `\n`,
bakeTarget: core.getInput('bake-target') || `ghaction-docker-meta`,
githubToken: core.getInput('github-token')
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/meta.ts
Expand Up @@ -378,7 +378,7 @@ export class Meta {
JSON.stringify(
{
target: {
'ghaction-docker-meta': {
[this.inputs.bakeTarget]: {
tags: this.getTags(),
labels: jsonLabels,
args: {
Expand Down

0 comments on commit 72e5d60

Please sign in to comment.