Skip to content

Commit

Permalink
feat: Add wrappers for twitch-announcement-discord-bot
Browse files Browse the repository at this point in the history
These actions are used in one of th workflows in
https://github.com/NikkyAI/twitch-announcement-discord-bot which uses
this library.
  • Loading branch information
krzema12 committed Feb 26, 2022
1 parent 511a479 commit 974adb7
Show file tree
Hide file tree
Showing 6 changed files with 518 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// This file was generated using 'wrapper-generator' module. Don't change it by hand, your changes will
// be overwritten with the next wrapper code regeneration. Instead, consider introducing changes to the
// generator itself.
package it.krzeminski.githubactions.actions.actions

import it.krzeminski.githubactions.actions.ActionWithOutputs
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List

/**
* Action: Cache
*
* Cache artifacts like dependencies and build outputs to improve workflow execution time
*
* [Action on GitHub](https://github.com/actions/cache)
*/
public class CacheV2(
/**
* A list of files, directories, and wildcard patterns to cache and restore
*/
public val path: List<String>,
/**
* An explicit key for restoring and saving the cache
*/
public val key: String,
/**
* An ordered list of keys to use for restoring the cache if no cache hit occurred for key
*/
public val restoreKeys: List<String>? = null,
/**
* The chunk size used to split up large files during upload, in bytes
*/
public val uploadChunkSize: Int? = null
) : ActionWithOutputs<CacheV2.Outputs>("actions", "cache", "v2") {
@Suppress("SpreadOperator")
public override fun toYamlArguments() = linkedMapOf(
*listOfNotNull(
"path" to path.joinToString("\n"),
"key" to key,
restoreKeys?.let { "restore-keys" to it.joinToString("\n") },
uploadChunkSize?.let { "upload-chunk-size" to it.toString() },
).toTypedArray()
)

public override fun buildOutputObject(stepId: String) = Outputs(stepId)

public class Outputs(
private val stepId: String
) {
/**
* A boolean value to indicate an exact match was found for the primary key
*/
public val cacheHit: String = "steps.$stepId.outputs.cache-hit"

public operator fun `get`(outputName: String) = "steps.$stepId.outputs.$outputName"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
// This file was generated using 'wrapper-generator' module. Don't change it by hand, your changes will
// be overwritten with the next wrapper code regeneration. Instead, consider introducing changes to the
// generator itself.
package it.krzeminski.githubactions.actions.docker

import it.krzeminski.githubactions.actions.ActionWithOutputs
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List

/**
* Action: Build and push Docker images
*
* Build and push Docker images with Buildx
*
* [Action on GitHub](https://github.com/docker/build-push-action)
*/
public class BuildPushActionV2(
/**
* List of a customs host-to-IP mapping (e.g., docker:10.180.0.1)
*/
public val addHosts: List<String>? = null,
/**
* List of extra privileged entitlement (e.g., network.host,security.insecure)
*/
public val allow: List<String>? = null,
/**
* List of build-time variables
*/
public val buildArgs: List<String>? = null,
/**
* Builder instance
*/
public val builder: String? = null,
/**
* List of external cache sources for buildx (e.g., user/app:cache, type=local,src=path/to/dir)
*/
public val cacheFrom: List<String>? = null,
/**
* List of cache export destinations for buildx (e.g., user/app:cache,
* type=local,dest=path/to/dir)
*/
public val cacheTo: List<String>? = null,
/**
* Optional parent cgroup for the container used in the build
*/
public val cgroupParent: String? = null,
/**
* Build's context is the set of files located in the specified PATH or URL
*/
public val context: String? = null,
/**
* Path to the Dockerfile
*/
public val `file`: String? = null,
/**
* List of metadata for an image
*/
public val labels: List<String>? = null,
/**
* Load is a shorthand for --output=type=docker
*/
public val load: Boolean? = null,
/**
* Set the networking mode for the RUN instructions during build
*/
public val network: String? = null,
/**
* Do not use cache when building the image
*/
public val noCache: Boolean? = null,
/**
* List of output destinations (format: type=local,dest=path)
*/
public val outputs: List<String>? = null,
/**
* List of target platforms for build
*/
public val platforms: List<String>? = null,
/**
* Always attempt to pull a newer version of the image
*/
public val pull: Boolean? = null,
/**
* Push is a shorthand for --output=type=registry
*/
public val push: Boolean? = null,
/**
* List of secrets to expose to the build (e.g., key=string, GIT_AUTH_TOKEN=mytoken)
*/
public val secrets: List<String>? = null,
/**
* List of secret files to expose to the build (e.g., key=filename, MY_SECRET=./secret.txt)
*/
public val secretFiles: List<String>? = null,
/**
* Size of /dev/shm (e.g., 2g)
*/
public val shmSize: String? = null,
/**
* List of SSH agent socket or keys to expose to the build
*/
public val ssh: List<String>? = null,
/**
* List of tags
*/
public val tags: List<String>? = null,
/**
* Sets the target stage to build
*/
public val target: String? = null,
/**
* Ulimit options (e.g., nofile=1024:1024)
*/
public val ulimit: String? = null,
/**
* GitHub Token used to authenticate against a repository for Git context
*/
public val githubToken: String? = null
) : ActionWithOutputs<BuildPushActionV2.Outputs>("docker", "build-push-action", "v2") {
@Suppress("SpreadOperator")
public override fun toYamlArguments() = linkedMapOf(
*listOfNotNull(
addHosts?.let { "add-hosts" to it.joinToString("\n") },
allow?.let { "allow" to it.joinToString("\n") },
buildArgs?.let { "build-args" to it.joinToString("\n") },
builder?.let { "builder" to it },
cacheFrom?.let { "cache-from" to it.joinToString("\n") },
cacheTo?.let { "cache-to" to it.joinToString("\n") },
cgroupParent?.let { "cgroup-parent" to it },
context?.let { "context" to it },
`file`?.let { "file" to it },
labels?.let { "labels" to it.joinToString(",") },
load?.let { "load" to it.toString() },
network?.let { "network" to it },
noCache?.let { "no-cache" to it.toString() },
outputs?.let { "outputs" to it.joinToString(",") },
platforms?.let { "platforms" to it.joinToString(",") },
pull?.let { "pull" to it.toString() },
push?.let { "push" to it.toString() },
secrets?.let { "secrets" to it.joinToString("\n") },
secretFiles?.let { "secret-files" to it.joinToString("\n") },
shmSize?.let { "shm-size" to it },
ssh?.let { "ssh" to it.joinToString("\n") },
tags?.let { "tags" to it.joinToString("\n") },
target?.let { "target" to it },
ulimit?.let { "ulimit" to it },
githubToken?.let { "github-token" to it },
).toTypedArray()
)

public override fun buildOutputObject(stepId: String) = Outputs(stepId)

public class Outputs(
private val stepId: String
) {
/**
* Image content-addressable identifier also called a digest
*/
public val digest: String = "steps.$stepId.outputs.digest"

/**
* Build result metadata
*/
public val metadata: String = "steps.$stepId.outputs.metadata"

public operator fun `get`(outputName: String) = "steps.$stepId.outputs.$outputName"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// This file was generated using 'wrapper-generator' module. Don't change it by hand, your changes will
// be overwritten with the next wrapper code regeneration. Instead, consider introducing changes to the
// generator itself.
package it.krzeminski.githubactions.actions.docker

import it.krzeminski.githubactions.actions.Action
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress

/**
* Action: Docker Login
*
* GitHub Action to login against a Docker registry
*
* [Action on GitHub](https://github.com/docker/login-action)
*/
public class LoginActionV1(
/**
* Server address of Docker registry. If not set then will default to Docker Hub
*/
public val registry: String? = null,
/**
* Username used to log against the Docker registry
*/
public val username: String? = null,
/**
* Password or personal access token used to log against the Docker registry
*/
public val password: String? = null,
/**
* Specifies whether the given registry is ECR (auto, true or false)
*/
public val ecr: Boolean? = null,
/**
* Log out from the Docker registry at the end of a job
*/
public val logout: Boolean? = null
) : Action("docker", "login-action", "v1") {
@Suppress("SpreadOperator")
public override fun toYamlArguments() = linkedMapOf(
*listOfNotNull(
registry?.let { "registry" to it },
username?.let { "username" to it },
password?.let { "password" to it },
ecr?.let { "ecr" to it.toString() },
logout?.let { "logout" to it.toString() },
).toTypedArray()
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
// This file was generated using 'wrapper-generator' module. Don't change it by hand, your changes will
// be overwritten with the next wrapper code regeneration. Instead, consider introducing changes to the
// generator itself.
package it.krzeminski.githubactions.actions.docker

import it.krzeminski.githubactions.actions.ActionWithOutputs
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List

/**
* Action: Docker Setup Buildx
*
* Set up Docker Buildx
*
* [Action on GitHub](https://github.com/docker/setup-buildx-action)
*/
public class SetupBuildxActionV1(
/**
* Buildx version. (eg. v0.3.0)
*/
public val version: String? = null,
/**
* Sets the builder driver to be used
*/
public val driver: String? = null,
/**
* List of additional driver-specific options. (eg. image=moby/buildkit:master)
*/
public val driverOpts: List<String>? = null,
/**
* Flags for buildkitd daemon
*/
public val buildkitdFlags: String? = null,
/**
* Sets up docker build command as an alias to docker buildx
*/
public val install: Boolean? = null,
/**
* Switch to this builder instance
*/
public val use: Boolean? = null,
/**
* Optional address for docker socket or context from `docker context ls`
*/
public val endpoint: String? = null,
/**
* BuildKit config file
*/
public val config: String? = null,
/**
* Inline BuildKit config
*/
public val configInline: String? = null
) : ActionWithOutputs<SetupBuildxActionV1.Outputs>("docker", "setup-buildx-action", "v1") {
@Suppress("SpreadOperator")
public override fun toYamlArguments() = linkedMapOf(
*listOfNotNull(
version?.let { "version" to it },
driver?.let { "driver" to it },
driverOpts?.let { "driver-opts" to it.joinToString("\n") },
buildkitdFlags?.let { "buildkitd-flags" to it },
install?.let { "install" to it.toString() },
use?.let { "use" to it.toString() },
endpoint?.let { "endpoint" to it },
config?.let { "config" to it },
configInline?.let { "config-inline" to it },
).toTypedArray()
)

public override fun buildOutputObject(stepId: String) = Outputs(stepId)

public class Outputs(
private val stepId: String
) {
/**
* Builder name
*/
public val name: String = "steps.$stepId.outputs.name"

/**
* Builder driver
*/
public val driver: String = "steps.$stepId.outputs.driver"

/**
* Builder node endpoint
*/
public val endpoint: String = "steps.$stepId.outputs.endpoint"

/**
* Builder node status
*/
public val status: String = "steps.$stepId.outputs.status"

/**
* Builder node flags (if applicable)
*/
public val flags: String = "steps.$stepId.outputs.flags"

/**
* Builder node platforms available (comma separated)
*/
public val platforms: String = "steps.$stepId.outputs.platforms"

public operator fun `get`(outputName: String) = "steps.$stepId.outputs.$outputName"
}
}
Loading

0 comments on commit 974adb7

Please sign in to comment.