Skip to content

Commit

Permalink
Rename buildx-version input to version
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
CrazyMax committed Aug 13, 2020
1 parent c3b8f61 commit 8f0f662
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/setup-buildx-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down
6 changes: 3 additions & 3 deletions setup-buildx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand All @@ -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` |
Expand Down
2 changes: 1 addition & 1 deletion setup-buildx/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ branding:
icon: 'truck'

inputs:
buildx-version:
version:
description: 'Buildx version. e.g. v0.3.0'
required: false
driver:
Expand Down
24 changes: 12 additions & 12 deletions setup-buildx/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
}

Expand All @@ -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);
}
Expand Down

0 comments on commit 8f0f662

Please sign in to comment.