From 34c4964b4a91a6f5500849a4ebe7156d024eb149 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Fri, 10 Mar 2023 00:22:42 +0100 Subject: [PATCH] use new implementation --- .github/workflows/ci.yml | 2 +- README.md | 8 +++----- __tests__/context.test.ts | 4 ++-- action.yml | 2 +- src/main.ts | 17 +++++++++++------ 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0310c63..2cc6351 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,4 +29,4 @@ jobs: name: Set up Docker uses: ./ with: - version: 23.0.0 + version: v23.0.0 diff --git a/README.md b/README.md index 14f9df2..b57c238 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,6 @@ jobs: - name: Set up Docker uses: crazy-max/ghaction-setup-docker@v1 - with: - version: 23.0.1 ``` ## Customizing @@ -43,9 +41,9 @@ jobs: Following inputs can be used as `step.with` keys -| Name | Type | Description | -|-----------|--------|-------------------------------------| -| `version` | String | Docker CE version (e.g., `23.0.1`). | +| Name | Type | Default | Description | +|-----------|--------|----------|--------------------------------------| +| `version` | String | `latest` | Docker CE version (e.g., `v23.0.1`). | ## Contributing diff --git a/__tests__/context.test.ts b/__tests__/context.test.ts index bca0983..0d5f15d 100644 --- a/__tests__/context.test.ts +++ b/__tests__/context.test.ts @@ -17,10 +17,10 @@ describe('getInputs', () => { [ 0, new Map([ - ['version', '23.0.1'], + ['version', 'v23.0.1'], ]), { - version: '23.0.1', + version: 'v23.0.1', } as context.Inputs ] ])( diff --git a/action.yml b/action.yml index 28e6176..2bb5ec8 100644 --- a/action.yml +++ b/action.yml @@ -8,7 +8,7 @@ branding: inputs: version: - description: 'Docker CE version. (e.g, 23.0.1)' + description: 'Docker CE version. (e.g, v23.0.1)' required: false runs: diff --git a/src/main.ts b/src/main.ts index 1a4a9e4..792b60f 100644 --- a/src/main.ts +++ b/src/main.ts @@ -13,18 +13,21 @@ actionsToolkit.run( // main async () => { const input: context.Inputs = context.getInputs(); + const runDir = path.join(os.homedir(), `setup-docker-action-${uuid.v4()}`); - const install = new Install(); + const install = new Install({ + runDir: runDir, + version: input.version + }); let toolDir; if (!(await Docker.isAvailable()) || input.version) { await core.group(`Download docker`, async () => { - toolDir = await install.download(input.version || 'latest'); + toolDir = await install.download(); }); } if (toolDir) { - const runDir = path.join(os.homedir(), `setup-docker-action-${uuid.v4()}`); stateHelper.setRunDir(runDir); - await install.install(toolDir, runDir, input.version); + await install.install(); } await core.group(`Docker info`, async () => { @@ -37,7 +40,9 @@ actionsToolkit.run( if (stateHelper.runDir.length == 0) { return; } - const install = new Install(); - await install.tearDown(stateHelper.runDir); + const install = new Install({ + runDir: stateHelper.runDir + }); + await install.tearDown(); } );