diff --git a/README.md b/README.md index 6601b8c..6358d53 100644 --- a/README.md +++ b/README.md @@ -195,25 +195,25 @@ Following inputs can be used as `step.with` keys | Name | Type | Description | |---------------------|----------|------------------------------------| -| `builder` | String | Builder instance (see [setup-buildx](https://github.com/docker/setup-buildx-action) action) | -| `context` | String | Build's context is the set of files located in the specified [`PATH` or `URL`](https://docs.docker.com/engine/reference/commandline/build/) (default [Git context](#git-context)) | -| `file` | String | Path to the Dockerfile. (default `{context}/Dockerfile`) | -| `build-args` | List | List of build-time variables | -| `labels` | List | List of metadata for an image | -| `tags` | List/CSV | List of tags | -| `pull` | Bool | Always attempt to pull a newer version of the image (default `false`) | -| `target` | String | Sets the target stage to build | | `allow` | List/CSV | List of [extra privileged entitlement](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#allow) (eg. `network.host,security.insecure`) | -| `no-cache` | Bool | Do not use cache when building the image (default `false`) | -| `platforms` | List/CSV | List of [target platforms](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#platform) for build | -| `load` | Bool | [Load](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#load) is a shorthand for `--output=type=docker` (default `false`) | -| `push` | Bool | [Push](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#push) is a shorthand for `--output=type=registry` (default `false`) | -| `outputs` | List | List of [output destinations](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#output) (format: `type=local,dest=path`) | +| `builder` | String | Builder instance (see [setup-buildx](https://github.com/docker/setup-buildx-action) action) | +| `build-args` | List | List of build-time variables | | `cache-from` | List | List of [external cache sources](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#cache-from) (eg. `type=local,src=path/to/dir`) | | `cache-to` | List | List of [cache export destinations](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#cache-to) (eg. `type=local,dest=path/to/dir`) | +| `context` | String | Build's context is the set of files located in the specified [`PATH` or `URL`](https://docs.docker.com/engine/reference/commandline/build/) (default [Git context](#git-context)) | +| `file` | String | Path to the Dockerfile. (default `{context}/Dockerfile`) | +| `labels` | List | List of metadata for an image | +| `load` | Bool | [Load](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#load) is a shorthand for `--output=type=docker` (default `false`) | +| `no-cache` | Bool | Do not use cache when building the image (default `false`) | +| `outputs` | List | List of [output destinations](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#output) (format: `type=local,dest=path`) | +| `platforms` | List/CSV | List of [target platforms](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#platform) for build | +| `pull` | Bool | Always attempt to pull a newer version of the image (default `false`) | +| `push` | Bool | [Push](https://github.com/docker/buildx/blob/master/docs/reference/buildx_build.md#push) is a shorthand for `--output=type=registry` (default `false`) | | `secrets` | List | List of secrets to expose to the build (eg. `key=string`, `GIT_AUTH_TOKEN=mytoken`) | | `secret-files` | List | List of secret files to expose to the build (eg. `key=filename`, `MY_SECRET=./secret.txt`) | | `ssh` | List | List of SSH agent socket or keys to expose to the build | +| `tags` | List/CSV | List of tags | +| `target` | String | Sets the target stage to build | ### outputs diff --git a/action.yml b/action.yml index 1e9608a..77b26aa 100644 --- a/action.yml +++ b/action.yml @@ -7,51 +7,14 @@ branding: color: 'blue' inputs: - builder: - description: "Builder instance" - required: false - context: - description: "Build's context is the set of files located in the specified PATH or URL" - required: false - file: - description: "Path to the Dockerfile" + allow: + description: "List of extra privileged entitlement (eg. network.host,security.insecure)" required: false build-args: description: "List of build-time variables" required: false - labels: - description: "List of metadata for an image" - required: false - tags: - description: "List of tags" - required: false - pull: - description: "Always attempt to pull a newer version of the image" - required: false - default: 'false' - target: - description: "Sets the target stage to build" - required: false - allow: - description: "List of extra privileged entitlement (eg. network.host,security.insecure)" - required: false - no-cache: - description: "Do not use cache when building the image" - required: false - default: 'false' - platforms: - description: "List of target platforms for build" - required: false - load: - description: "Load is a shorthand for --output=type=docker" - required: false - default: 'false' - push: - description: "Push is a shorthand for --output=type=registry" - required: false - default: 'false' - outputs: - description: "List of output destinations (format: type=local,dest=path)" + builder: + description: "Builder instance" required: false cache-from: description: "List of external cache sources for buildx (eg. user/app:cache, type=local,src=path/to/dir)" @@ -59,6 +22,37 @@ inputs: cache-to: description: "List of cache export destinations for buildx (eg. user/app:cache, type=local,dest=path/to/dir)" required: false + context: + description: "Build's context is the set of files located in the specified PATH or URL" + required: false + file: + description: "Path to the Dockerfile" + required: false + labels: + description: "List of metadata for an image" + required: false + load: + description: "Load is a shorthand for --output=type=docker" + required: false + default: 'false' + no-cache: + description: "Do not use cache when building the image" + required: false + default: 'false' + outputs: + description: "List of output destinations (format: type=local,dest=path)" + required: false + platforms: + description: "List of target platforms for build" + required: false + pull: + description: "Always attempt to pull a newer version of the image" + required: false + default: 'false' + push: + description: "Push is a shorthand for --output=type=registry" + required: false + default: 'false' secrets: description: "List of secrets to expose to the build (eg. key=string, GIT_AUTH_TOKEN=mytoken)" required: false @@ -68,6 +62,12 @@ inputs: ssh: description: "List of SSH agent socket or keys to expose to the build" required: false + tags: + description: "List of tags" + required: false + target: + description: "Sets the target stage to build" + required: false github-token: description: "GitHub Token used to authenticate against a repository for Git context" default: ${{ github.token }} diff --git a/dist/index.js b/dist/index.js index 989e3ff..aee4be1 100644 --- a/dist/index.js +++ b/dist/index.js @@ -13033,26 +13033,26 @@ exports.tmpNameSync = tmpNameSync; function getInputs(defaultContext) { return __awaiter(this, void 0, void 0, function* () { return { - context: core.getInput('context') || defaultContext, - file: core.getInput('file'), - buildArgs: yield getInputList('build-args', true), - labels: yield getInputList('labels', true), - tags: yield getInputList('tags'), - pull: /true/i.test(core.getInput('pull')), - target: core.getInput('target'), allow: yield getInputList('allow'), - noCache: /true/i.test(core.getInput('no-cache')), + buildArgs: yield getInputList('build-args', true), builder: core.getInput('builder'), - platforms: yield getInputList('platforms'), - load: /true/i.test(core.getInput('load')), - push: /true/i.test(core.getInput('push')), - outputs: yield getInputList('outputs', true), cacheFrom: yield getInputList('cache-from', true), cacheTo: yield getInputList('cache-to', true), + context: core.getInput('context') || defaultContext, + file: core.getInput('file'), + labels: yield getInputList('labels', true), + load: /true/i.test(core.getInput('load')), + noCache: /true/i.test(core.getInput('no-cache')), + outputs: yield getInputList('outputs', true), + platforms: yield getInputList('platforms'), + pull: /true/i.test(core.getInput('pull')), + push: /true/i.test(core.getInput('push')), secrets: yield getInputList('secrets', true), secretFiles: yield getInputList('secret-files', true), - githubToken: core.getInput('github-token'), - ssh: yield getInputList('ssh') + ssh: yield getInputList('ssh'), + tags: yield getInputList('tags'), + target: core.getInput('target'), + githubToken: core.getInput('github-token') }; }); } diff --git a/src/context.ts b/src/context.ts index 35df65a..922c430 100644 --- a/src/context.ts +++ b/src/context.ts @@ -13,26 +13,26 @@ import * as buildx from './buildx'; let _defaultContext, _tmpDir: string; export interface Inputs { - context: string; - file: string; - buildArgs: string[]; - labels: string[]; - tags: string[]; - pull: boolean; - target: string; allow: string[]; - noCache: boolean; + buildArgs: string[]; builder: string; - platforms: string[]; - load: boolean; - push: boolean; - outputs: string[]; cacheFrom: string[]; cacheTo: string[]; + context: string; + file: string; + labels: string[]; + load: boolean; + noCache: boolean; + outputs: string[]; + platforms: string[]; + pull: boolean; + push: boolean; secrets: string[]; secretFiles: string[]; - githubToken: string; ssh: string[]; + tags: string[]; + target: string; + githubToken: string; } export function defaultContext(): string { @@ -57,26 +57,26 @@ export function tmpNameSync(options?: tmp.TmpNameOptions): string { export async function getInputs(defaultContext: string): Promise { return { - context: core.getInput('context') || defaultContext, - file: core.getInput('file'), - buildArgs: await getInputList('build-args', true), - labels: await getInputList('labels', true), - tags: await getInputList('tags'), - pull: /true/i.test(core.getInput('pull')), - target: core.getInput('target'), allow: await getInputList('allow'), - noCache: /true/i.test(core.getInput('no-cache')), + buildArgs: await getInputList('build-args', true), builder: core.getInput('builder'), - platforms: await getInputList('platforms'), - load: /true/i.test(core.getInput('load')), - push: /true/i.test(core.getInput('push')), - outputs: await getInputList('outputs', true), cacheFrom: await getInputList('cache-from', true), cacheTo: await getInputList('cache-to', true), + context: core.getInput('context') || defaultContext, + file: core.getInput('file'), + labels: await getInputList('labels', true), + load: /true/i.test(core.getInput('load')), + noCache: /true/i.test(core.getInput('no-cache')), + outputs: await getInputList('outputs', true), + platforms: await getInputList('platforms'), + pull: /true/i.test(core.getInput('pull')), + push: /true/i.test(core.getInput('push')), secrets: await getInputList('secrets', true), secretFiles: await getInputList('secret-files', true), - githubToken: core.getInput('github-token'), - ssh: await getInputList('ssh') + ssh: await getInputList('ssh'), + tags: await getInputList('tags'), + target: core.getInput('target'), + githubToken: core.getInput('github-token') }; }