Skip to content

Commit

Permalink
feat(actions): add actions/upload-artifact@v4
Browse files Browse the repository at this point in the history
  • Loading branch information
krzema12 committed Dec 22, 2023
1 parent d482963 commit 43e49f4
Show file tree
Hide file tree
Showing 8 changed files with 163 additions and 4 deletions.
Empty file.
1 change: 1 addition & 0 deletions actions/actions/upload-artifact/v4/commit-hash.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c7d193f32edcb7bfad88892161225aeda64e9392
4 changes: 2 additions & 2 deletions docs/supported-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Click on a version to see the binding's code.
* [setup-node](https://github.com/actions/setup-node) - v2: [`SetupNodeV2`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/SetupNodeV2.kt), v3: [`SetupNodeV3`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/SetupNodeV3.kt), v4: [`SetupNodeV4`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/SetupNodeV4.kt)
* [setup-python](https://github.com/actions/setup-python) - v2: [`SetupPythonV2`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/SetupPythonV2.kt), v3: [`SetupPythonV3`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/SetupPythonV3.kt), v4: [`SetupPythonV4`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/SetupPythonV4.kt), v5: [`SetupPythonV5`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/SetupPythonV5.kt)
* [stale](https://github.com/actions/stale) - v5: [`StaleV5`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/StaleV5.kt), v6: [`StaleV6`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/StaleV6.kt), v7: [`StaleV7`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/StaleV7.kt), v8: [`StaleV8`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/StaleV8.kt), v9: [`StaleV9`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/StaleV9.kt)
* [upload-artifact](https://github.com/actions/upload-artifact) - v2: [`UploadArtifactV2`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/UploadArtifactV2.kt), v3: [`UploadArtifactV3`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/UploadArtifactV3.kt)
* [upload-artifact](https://github.com/actions/upload-artifact) - v2: [`UploadArtifactV2`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/UploadArtifactV2.kt), v3: [`UploadArtifactV3`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/UploadArtifactV3.kt), v4: [`UploadArtifactV4`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/actions/UploadArtifactV4.kt)
* anmol098
* [waka-readme-stats](https://github.com/anmol098/waka-readme-stats) - v4: [`WakaReadmeStatsV4`](https://github.com/typesafegithub/github-workflows-kt/blob/v[[ version ]]/github-workflows-kt/src/gen/kotlin/io/github/typesafegithub/workflows/actions/anmol098/WakaReadmeStatsV4.kt)
* anothrNick
Expand Down Expand Up @@ -140,6 +140,6 @@ Click on a version to see the binding's code.
Number of bindings available:

* counting by actions: 84
* counting each version separately: 142
* counting each version separately: 143

Actions [providing typings](https://github.com/typesafegithub/github-actions-typing/) (marked with ✅ on the above list): 18
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import kotlin.collections.toTypedArray
* [Action on GitHub](https://github.com/actions/upload-artifact)
*/
@Deprecated(
message = "This action has a newer major version: UploadArtifactV3",
replaceWith = ReplaceWith("UploadArtifactV3"),
message = "This action has a newer major version: UploadArtifactV4",
replaceWith = ReplaceWith("UploadArtifactV4"),
)
public data class UploadArtifactV2 private constructor(
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
@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.Deprecated
import kotlin.Int
import kotlin.String
import kotlin.Suppress
Expand All @@ -27,6 +29,10 @@ import kotlin.collections.toTypedArray
*
* [Action on GitHub](https://github.com/actions/upload-artifact)
*/
@Deprecated(
message = "This action has a newer major version: UploadArtifactV4",
replaceWith = ReplaceWith("UploadArtifactV4"),
)
public data class UploadArtifactV3 private constructor(
/**
* Artifact name
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
// 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.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)
*/
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,
/**
* 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,
_customInputs: Map<String, String> = mapOf(),
_customVersion: String? = null,
) : this(name=name, path=path, ifNoFilesFound=ifNoFilesFound, retentionDays=retentionDays,
compressionLevel=compressionLevel, _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() },
*_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 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"
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION") // Use deprecated action versions, to not have to update them.

package io.github.typesafegithub.workflows.docsnippets

import io.github.typesafegithub.workflows.actions.actions.UploadArtifactV3
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@file:Suppress("DEPRECATION") // Use deprecated action versions, to not have to update them.

package io.github.typesafegithub.workflows.yaml

import io.github.typesafegithub.workflows.actions.actions.CheckoutV4
Expand Down

0 comments on commit 43e49f4

Please sign in to comment.