Rename buildx-version input to version

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2020-08-13 10:42:57 +02:00
parent c3b8f61f90
commit 8f0f662386
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
4 changed files with 18 additions and 18 deletions

View file

@ -39,7 +39,7 @@ jobs:
id: buildx
uses: ./setup-buildx/
with:
buildx-version: ${{ matrix.buildx-version }}
version: ${{ matrix.buildx-version }}
-
name: Builder instance name
run: echo ${{ steps.buildx.outputs.name }}
@ -155,7 +155,7 @@ jobs:
id: buildx
uses: ./setup-buildx/
with:
buildx-version: ${{ matrix.buildx-version }}
version: ${{ matrix.buildx-version }}
-
name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}

View file

@ -39,7 +39,7 @@ jobs:
id: buildx
uses: docker/actions/setup-buildx@v1
with:
buildx-version: latest
version: latest
-
name: Builder instance name
run: echo ${{ steps.buildx.outputs.name }}
@ -79,7 +79,7 @@ jobs:
id: buildx
uses: docker/actions/setup-buildx@v1
with:
buildx-version: latest
version: latest
-
name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
@ -93,7 +93,7 @@ Following inputs can be used as `step.with` keys
| Name | Type | Default | Description |
|------------------|---------|-----------------------------------|------------------------------------|
| `buildx-version` | String | _the one installed on the runner_ | [Buildx](https://github.com/docker/buildx) version. e.g. `v0.3.0`, `latest` |
| `version` | String | _the one installed on the runner_ | [Buildx](https://github.com/docker/buildx) version. e.g. `v0.3.0`, `latest` |
| `driver` | String | `docker-container` | Sets the [builder driver](https://github.com/docker/buildx#--driver-driver) to be used. |
| `driver-opt` | String | | Passes additional [driver-specific options](https://github.com/docker/buildx#--driver-opt-options). e.g. `image=moby/buildkit:master` |
| `install` | Bool | `false` | Sets up `docker build` command as an alias to `docker buildx` |

View file

@ -7,7 +7,7 @@ branding:
icon: 'truck'
inputs:
buildx-version:
version:
description: 'Buildx version. e.g. v0.3.0'
required: false
driver:

View file

@ -12,16 +12,16 @@ async function run(): Promise<void> {
return;
}
const buildxVer: string = core.getInput('buildx-version');
const driver: string = core.getInput('driver') || 'docker-container';
const driverOpt: string = core.getInput('driver-opt');
const install: boolean = /true/i.test(core.getInput('install'));
const use: boolean = /true/i.test(core.getInput('use'));
const bxVersion: string = core.getInput('version');
const bxDriver: string = core.getInput('driver') || 'docker-container';
const bxDriverOpt: string = core.getInput('driver-opt');
const bxInstall: boolean = /true/i.test(core.getInput('install'));
const bxUse: boolean = /true/i.test(core.getInput('use'));
const dockerConfigHome: string = process.env.DOCKER_CONFIG || path.join(os.homedir(), '.docker');
if (!(await buildx.isAvailable()) || buildxVer) {
await buildx.install(buildxVer || 'latest', dockerConfigHome);
if (!(await buildx.isAvailable()) || bxVersion) {
await buildx.install(bxVersion || 'latest', dockerConfigHome);
}
core.info('📣 Buildx info');
@ -32,11 +32,11 @@ async function run(): Promise<void> {
stateHelper.setBuilderName(builderName);
core.info('🔨 Creating a new builder instance...');
let createArgs: Array<string> = ['buildx', 'create', '--name', builderName, '--driver', driver];
if (driverOpt) {
createArgs.push('--driver-opt', driverOpt);
let createArgs: Array<string> = ['buildx', 'create', '--name', builderName, '--driver', bxDriver];
if (bxDriverOpt) {
createArgs.push('--driver-opt', bxDriverOpt);
}
if (use) {
if (bxUse) {
createArgs.push('--use');
}
@ -45,7 +45,7 @@ async function run(): Promise<void> {
core.info('🏃 Booting builder...');
await exec.exec('docker', ['buildx', 'inspect', '--bootstrap'], false);
if (install) {
if (bxInstall) {
core.info('🤝 Setting buildx as default builder...');
await exec.exec('docker', ['buildx', 'install'], false);
}