-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
SetupNodeV3.kt
188 lines (177 loc) · 8.03 KB
/
SetupNodeV3.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
// 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.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.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: Setup Node.js environment
*
* Setup a Node.js environment by adding problem matchers and optionally downloading and adding it
* to the PATH.
*
* [Action on GitHub](https://github.com/actions/setup-node)
*
* @param alwaysAuth Set always-auth in npmrc.
* @param nodeVersion Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0.
* @param nodeVersionFile File containing the version Spec of the version to use. Examples: .nvmrc,
* .node-version, .tool-versions.
* @param architecture Target architecture for Node to use. Examples: x86, x64. Will use system
* architecture by default.
* @param checkLatest Set this option if you want the action to check for the latest available
* version that satisfies the version spec.
* @param registryUrl Optional registry to set up for auth. Will set the registry in a project level
* .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN.
* @param scope Optional scope for authenticating against scoped registries. Will fall back to the
* repository owner when using the GitHub Packages registry (https://npm.pkg.github.com/).
* @param token Used to pull node distributions from node-versions. Since there's a default, this is
* typically not supplied by the user. When running this action on github.com, the default value is
* sufficient. When running on GHES, you can pass a personal access token for github.com if you are
* experiencing rate limiting.
* @param cache Used to specify a package manager for caching in the default directory. Supported
* values: npm, yarn, pnpm.
* @param cacheDependencyPath Used to specify the path to a dependency file: package-lock.json,
* yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies.
* @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: SetupNodeV4",
replaceWith = ReplaceWith("SetupNodeV4"),
)
public data class SetupNodeV3 private constructor(
/**
* Set always-auth in npmrc.
*/
public val alwaysAuth: Boolean? = null,
/**
* Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0.
*/
public val nodeVersion: String? = null,
/**
* File containing the version Spec of the version to use. Examples: .nvmrc, .node-version,
* .tool-versions.
*/
public val nodeVersionFile: String? = null,
/**
* Target architecture for Node to use. Examples: x86, x64. Will use system architecture by
* default.
*/
public val architecture: String? = null,
/**
* Set this option if you want the action to check for the latest available version that
* satisfies the version spec.
*/
public val checkLatest: Boolean? = null,
/**
* Optional registry to set up for auth. Will set the registry in a project level .npmrc and
* .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN.
*/
public val registryUrl: String? = null,
/**
* Optional scope for authenticating against scoped registries. Will fall back to the repository
* owner when using the GitHub Packages registry (https://npm.pkg.github.com/).
*/
public val scope: String? = null,
/**
* Used to pull node distributions from node-versions. Since there's a default, this is
* typically not supplied by the user. When running this action on github.com, the default value is
* sufficient. When running on GHES, you can pass a personal access token for github.com if you are
* experiencing rate limiting.
*/
public val token: String? = null,
/**
* Used to specify a package manager for caching in the default directory. Supported values:
* npm, yarn, pnpm.
*/
public val cache: SetupNodeV3.PackageManager? = null,
/**
* Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. Supports
* wildcards or a list of file names for caching multiple dependencies.
*/
public val cacheDependencyPath: List<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<SetupNodeV3.Outputs>("actions", "setup-node", _customVersion ?: "v3") {
public constructor(
vararg pleaseUseNamedArguments: Unit,
alwaysAuth: Boolean? = null,
nodeVersion: String? = null,
nodeVersionFile: String? = null,
architecture: String? = null,
checkLatest: Boolean? = null,
registryUrl: String? = null,
scope: String? = null,
token: String? = null,
cache: SetupNodeV3.PackageManager? = null,
cacheDependencyPath: List<String>? = null,
_customInputs: Map<String, String> = mapOf(),
_customVersion: String? = null,
) : this(alwaysAuth=alwaysAuth, nodeVersion=nodeVersion, nodeVersionFile=nodeVersionFile,
architecture=architecture, checkLatest=checkLatest, registryUrl=registryUrl,
scope=scope, token=token, cache=cache, cacheDependencyPath=cacheDependencyPath,
_customInputs=_customInputs, _customVersion=_customVersion)
@Suppress("SpreadOperator")
override fun toYamlArguments(): LinkedHashMap<String, String> = linkedMapOf(
*listOfNotNull(
alwaysAuth?.let { "always-auth" to it.toString() },
nodeVersion?.let { "node-version" to it },
nodeVersionFile?.let { "node-version-file" to it },
architecture?.let { "architecture" to it },
checkLatest?.let { "check-latest" to it.toString() },
registryUrl?.let { "registry-url" to it },
scope?.let { "scope" to it },
token?.let { "token" to it },
cache?.let { "cache" to it.stringValue },
cacheDependencyPath?.let { "cache-dependency-path" to it.joinToString("\n") },
*_customInputs.toList().toTypedArray(),
).toTypedArray()
)
override fun buildOutputObject(stepId: String): Outputs = Outputs(stepId)
public sealed class PackageManager(
public val stringValue: String,
) {
public object Npm : SetupNodeV3.PackageManager("npm")
public object Yarn : SetupNodeV3.PackageManager("yarn")
public object Pnpm : SetupNodeV3.PackageManager("pnpm")
public class Custom(
customStringValue: String,
) : SetupNodeV3.PackageManager(customStringValue)
}
public class Outputs(
stepId: String,
) : Action.Outputs(stepId) {
/**
* A boolean value to indicate if a cache was hit.
*/
public val cacheHit: String = "steps.$stepId.outputs.cache-hit"
/**
* The installed node version.
*/
public val nodeVersion: String = "steps.$stepId.outputs.node-version"
}
}