-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
UploadArtifactV4.kt
194 lines (176 loc) · 8.66 KB
/
UploadArtifactV4.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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
// 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",
)
package io.github.typesafegithub.workflows.actions.actions
import io.github.typesafegithub.workflows.domain.actions.Action
import io.github.typesafegithub.workflows.domain.actions.RegularAction
import java.util.LinkedHashMap
import kotlin.Boolean
import kotlin.Int
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: Upload a Build Artifact
*
* Upload a build artifact that can be used by subsequent workflow steps
*
* [Action on GitHub](https://github.com/actions/upload-artifact)
*
* @param name Artifact name
* @param path A file, directory or wildcard pattern that describes what to upload
* @param ifNoFilesFound The desired behavior if no files are found using the provided path.
* Available Options:
* warn: Output a warning but do not fail the action
* error: Fail the action with an error message
* ignore: Do not output any warnings or errors, the action does not fail
* @param retentionDays Duration after which artifact will expire in days. 0 means using default
* retention.
* Minimum 1 day. Maximum 90 days unless changed from the repository settings page.
* @param compressionLevel The level of compression for Zlib to be applied to the artifact archive.
* The value can range from 0 to 9: - 0: No compression - 1: Best speed - 6: Default compression (same
* as GNU Gzip) - 9: Best compression Higher levels will result in better compression, but will take
* longer to complete. For large files that are not easily compressed, a value of 0 is recommended for
* significantly faster uploads.
* @param overwrite If true, an artifact with a matching name will be deleted before a new one is
* uploaded. If false, the action will fail if an artifact for the given name already exists. Does not
* fail if the artifact does not exist.
* @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
*/
public data class UploadArtifactV4 private constructor(
/**
* Artifact name
*/
public val name: String? = null,
/**
* A file, directory or wildcard pattern that describes what to upload
*/
public val path: List<String>,
/**
* The desired behavior if no files are found using the provided path.
* Available Options:
* warn: Output a warning but do not fail the action
* error: Fail the action with an error message
* ignore: Do not output any warnings or errors, the action does not fail
*/
public val ifNoFilesFound: UploadArtifactV4.BehaviorIfNoFilesFound? = null,
/**
* Duration after which artifact will expire in days. 0 means using default retention.
* Minimum 1 day. Maximum 90 days unless changed from the repository settings page.
*/
public val retentionDays: UploadArtifactV4.RetentionPeriod? = null,
/**
* The level of compression for Zlib to be applied to the artifact archive. The value can range
* from 0 to 9: - 0: No compression - 1: Best speed - 6: Default compression (same as GNU Gzip) -
* 9: Best compression Higher levels will result in better compression, but will take longer to
* complete. For large files that are not easily compressed, a value of 0 is recommended for
* significantly faster uploads.
*/
public val compressionLevel: UploadArtifactV4.CompressionLevel? = null,
/**
* If true, an artifact with a matching name will be deleted before a new one is uploaded. If
* false, the action will fail if an artifact for the given name already exists. Does not fail if
* the artifact does not exist.
*/
public val overwrite: Boolean? = 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<UploadArtifactV4.Outputs>("actions", "upload-artifact", _customVersion ?: "v4") {
public constructor(
vararg pleaseUseNamedArguments: Unit,
name: String? = null,
path: List<String>,
ifNoFilesFound: UploadArtifactV4.BehaviorIfNoFilesFound? = null,
retentionDays: UploadArtifactV4.RetentionPeriod? = null,
compressionLevel: UploadArtifactV4.CompressionLevel? = null,
overwrite: Boolean? = null,
_customInputs: Map<String, String> = mapOf(),
_customVersion: String? = null,
) : this(name=name, path=path, ifNoFilesFound=ifNoFilesFound, retentionDays=retentionDays,
compressionLevel=compressionLevel, overwrite=overwrite, _customInputs=_customInputs,
_customVersion=_customVersion)
@Suppress("SpreadOperator")
override fun toYamlArguments(): LinkedHashMap<String, String> = linkedMapOf(
*listOfNotNull(
name?.let { "name" to it },
"path" to path.joinToString("\n"),
ifNoFilesFound?.let { "if-no-files-found" to it.stringValue },
retentionDays?.let { "retention-days" to it.integerValue.toString() },
compressionLevel?.let { "compression-level" to it.integerValue.toString() },
overwrite?.let { "overwrite" to it.toString() },
*_customInputs.toList().toTypedArray(),
).toTypedArray()
)
override fun buildOutputObject(stepId: String): Outputs = Outputs(stepId)
public sealed class BehaviorIfNoFilesFound(
public val stringValue: String,
) {
public object Warn : UploadArtifactV4.BehaviorIfNoFilesFound("warn")
public object Error : UploadArtifactV4.BehaviorIfNoFilesFound("error")
public object Ignore : UploadArtifactV4.BehaviorIfNoFilesFound("ignore")
public class Custom(
customStringValue: String,
) : UploadArtifactV4.BehaviorIfNoFilesFound(customStringValue)
}
public sealed class RetentionPeriod(
public val integerValue: Int,
) {
public class Value(
requestedValue: Int,
) : UploadArtifactV4.RetentionPeriod(requestedValue)
public object Default : UploadArtifactV4.RetentionPeriod(0)
}
public sealed class CompressionLevel(
public val integerValue: Int,
) {
public class Value(
requestedValue: Int,
) : UploadArtifactV4.CompressionLevel(requestedValue)
public object NoCompression : UploadArtifactV4.CompressionLevel(0)
public object BestSpeed : UploadArtifactV4.CompressionLevel(1)
public object DefaultCompression : UploadArtifactV4.CompressionLevel(6)
public object BestCompression : UploadArtifactV4.CompressionLevel(9)
}
public class Outputs(
stepId: String,
) : Action.Outputs(stepId) {
/**
* A unique identifier for the artifact that was just uploaded. Empty if the artifact upload
* failed.
* This ID can be used as input to other APIs to download, delete or get more information
* about an artifact: https://docs.github.com/en/rest/actions/artifacts
*/
public val artifactId: String = "steps.$stepId.outputs.artifact-id"
/**
* A download URL for the artifact that was just uploaded. Empty if the artifact upload
* failed.
* This download URL only works for requests Authenticated with GitHub. Anonymous downloads
* will be prompted to first login. If an anonymous download URL is needed than a short time
* restricted URL can be generated using the download artifact API:
* https://docs.github.com/en/rest/actions/artifacts#download-an-artifact
* This URL will be valid for as long as the artifact exists and the workflow run and
* repository exists. Once an artifact has expired this URL will no longer work. Common uses
* cases for such a download URL can be adding download links to artifacts in descriptions or
* comments on pull requests or issues.
*/
public val artifactUrl: String = "steps.$stepId.outputs.artifact-url"
}
}