-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
MetadataActionV4.kt
171 lines (158 loc) · 5.97 KB
/
MetadataActionV4.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
// This file was generated using action-binding-generator. Don't change it by hand, otherwise your
// changes will be overwritten with the next binding code regeneration.
// See https://github.com/typesafegithub/github-workflows-kt for more info.
@file:Suppress(
"DataClassPrivateConstructor",
"UNUSED_PARAMETER",
"DEPRECATION",
)
package io.github.typesafegithub.workflows.actions.docker
import io.github.typesafegithub.workflows.domain.actions.Action
import io.github.typesafegithub.workflows.domain.actions.RegularAction
import java.util.LinkedHashMap
import kotlin.Deprecated
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import kotlin.collections.toList
import kotlin.collections.toTypedArray
/**
* Action: Docker Metadata action
*
* GitHub Action to extract metadata (tags, labels) for Docker
*
* [Action on GitHub](https://github.com/docker/metadata-action)
*
* @param context Where to get context data. Allowed options are "workflow" (default), "git".
* @param images List of Docker images to use as base name for tags
* @param tags List of tags as key-value pair attributes
* @param flavor Flavors to apply
* @param labels List of custom labels
* @param sepTags Separator to use for tags output (default \n)
* @param sepLabels Separator to use for labels output (default \n)
* @param bakeTarget Bake target name (default docker-metadata-action)
* @param githubToken GitHub Token as provided by secrets
* @param _customInputs Type-unsafe map where you can put any inputs that are not yet supported by
* the binding
* @param _customVersion Allows overriding action's version, for example to use a specific minor
* version, or a newer version that the binding doesn't yet know about
*/
@Deprecated(
message = "This action has a newer major version: MetadataActionV5",
replaceWith = ReplaceWith("MetadataActionV5"),
)
public data class MetadataActionV4 private constructor(
/**
* Where to get context data. Allowed options are "workflow" (default), "git".
*/
public val context: MetadataActionV4.Context? = null,
/**
* List of Docker images to use as base name for tags
*/
public val images: List<String>,
/**
* List of tags as key-value pair attributes
*/
public val tags: List<String>? = null,
/**
* Flavors to apply
*/
public val flavor: List<String>? = null,
/**
* List of custom labels
*/
public val labels: List<String>? = null,
/**
* Separator to use for tags output (default \n)
*/
public val sepTags: String? = null,
/**
* Separator to use for labels output (default \n)
*/
public val sepLabels: String? = null,
/**
* Bake target name (default docker-metadata-action)
*/
public val bakeTarget: String? = null,
/**
* GitHub Token as provided by secrets
*/
public val githubToken: String? = null,
/**
* Type-unsafe map where you can put any inputs that are not yet supported by the binding
*/
public val _customInputs: Map<String, String> = mapOf(),
/**
* Allows overriding action's version, for example to use a specific minor version, or a newer
* version that the binding doesn't yet know about
*/
public val _customVersion: String? = null,
) : RegularAction<MetadataActionV4.Outputs>("docker", "metadata-action", _customVersion ?: "v4") {
public constructor(
vararg pleaseUseNamedArguments: Unit,
context: MetadataActionV4.Context? = null,
images: List<String>,
tags: List<String>? = null,
flavor: List<String>? = null,
labels: List<String>? = null,
sepTags: String? = null,
sepLabels: String? = null,
bakeTarget: String? = null,
githubToken: String? = null,
_customInputs: Map<String, String> = mapOf(),
_customVersion: String? = null,
) : this(context=context, images=images, tags=tags, flavor=flavor, labels=labels,
sepTags=sepTags, sepLabels=sepLabels, bakeTarget=bakeTarget, githubToken=githubToken,
_customInputs=_customInputs, _customVersion=_customVersion)
@Suppress("SpreadOperator")
override fun toYamlArguments(): LinkedHashMap<String, String> = linkedMapOf(
*listOfNotNull(
context?.let { "context" to it.stringValue },
"images" to images.joinToString("\n"),
tags?.let { "tags" to it.joinToString("\n") },
flavor?.let { "flavor" to it.joinToString("\n") },
labels?.let { "labels" to it.joinToString("\n") },
sepTags?.let { "sep-tags" to it },
sepLabels?.let { "sep-labels" to it },
bakeTarget?.let { "bake-target" to it },
githubToken?.let { "github-token" to it },
*_customInputs.toList().toTypedArray(),
).toTypedArray()
)
override fun buildOutputObject(stepId: String): Outputs = Outputs(stepId)
public sealed class Context(
public val stringValue: String,
) {
public object Workflow : MetadataActionV4.Context("workflow")
public object Git : MetadataActionV4.Context("git")
public class Custom(
customStringValue: String,
) : MetadataActionV4.Context(customStringValue)
}
public class Outputs(
stepId: String,
) : Action.Outputs(stepId) {
/**
* Generated Docker image version
*/
public val version: String = "steps.$stepId.outputs.version"
/**
* Generated Docker tags
*/
public val tags: String = "steps.$stepId.outputs.tags"
/**
* Generated Docker labels
*/
public val labels: String = "steps.$stepId.outputs.labels"
/**
* Bake definiton file
*/
public val bakeFile: String = "steps.$stepId.outputs.bake-file"
/**
* JSON output of tags and labels
*/
public val json: String = "steps.$stepId.outputs.json"
}
}