mirror of
https://github.com/docker/setup-docker-action.git
synced 2025-12-16 10:28:27 +00:00
Compare commits
No commits in common. "master" and "v4.2.0" have entirely different histories.
14 changed files with 250 additions and 807 deletions
88
.github/workflows/ci.yml
vendored
88
.github/workflows/ci.yml
vendored
|
|
@ -29,16 +29,16 @@ jobs:
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- ubuntu-24.04-arm
|
- ubuntu-24.04-arm
|
||||||
- macos-15-intel
|
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||||
|
- macos-13
|
||||||
- windows-latest
|
- windows-latest
|
||||||
version:
|
version:
|
||||||
- ""
|
|
||||||
- v27.3.1
|
- v27.3.1
|
||||||
- type=image,tag=27.3.1
|
- type=image,tag=27.3.1
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|
@ -53,12 +53,13 @@ jobs:
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- ubuntu-24.04-arm
|
- ubuntu-24.04-arm
|
||||||
- macos-15-intel
|
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||||
|
- macos-13
|
||||||
- windows-latest
|
- windows-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|
@ -74,12 +75,13 @@ jobs:
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- ubuntu-24.04-arm
|
- ubuntu-24.04-arm
|
||||||
- macos-15-intel
|
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||||
|
- macos-13
|
||||||
- windows-latest
|
- windows-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|
@ -101,12 +103,13 @@ jobs:
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- ubuntu-24.04-arm
|
- ubuntu-24.04-arm
|
||||||
- macos-15-intel
|
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||||
|
- macos-13
|
||||||
- windows-latest
|
- windows-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|
@ -119,11 +122,12 @@ jobs:
|
||||||
docker context inspect foo
|
docker context inspect foo
|
||||||
|
|
||||||
lima-start-args:
|
lima-start-args:
|
||||||
runs-on: macos-15-intel
|
#runs-on: macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||||
|
runs-on: macos-13
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|
@ -143,7 +147,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Uninstall containerd
|
name: Uninstall containerd
|
||||||
if: matrix.containerd == 'containerd-tarball'
|
if: matrix.containerd == 'containerd-tarball'
|
||||||
|
|
@ -183,11 +187,12 @@ jobs:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
- macos-15-intel
|
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||||
|
- macos-13
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|
@ -221,7 +226,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|
@ -242,7 +247,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|
@ -259,7 +264,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|
@ -279,12 +284,13 @@ jobs:
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- ubuntu-24.04-arm
|
- ubuntu-24.04-arm
|
||||||
- macos-15-intel
|
#- macos-14 # no virt: https://github.com/docker/actions-toolkit/issues/317
|
||||||
|
- macos-13
|
||||||
- windows-latest
|
- windows-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Set up Docker
|
name: Set up Docker
|
||||||
id: setup_docker
|
id: setup_docker
|
||||||
|
|
@ -298,47 +304,3 @@ jobs:
|
||||||
docker info
|
docker info
|
||||||
env:
|
env:
|
||||||
DOCKER_HOST: ${{ steps.setup_docker.outputs.tcp }}
|
DOCKER_HOST: ${{ steps.setup_docker.outputs.tcp }}
|
||||||
|
|
||||||
undock-regctl-version:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
undock_version:
|
|
||||||
- ''
|
|
||||||
- v0.9.0
|
|
||||||
regctl_version:
|
|
||||||
- ''
|
|
||||||
- v0.8.2
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
-
|
|
||||||
name: Set up Docker
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
version: type=image
|
|
||||||
env:
|
|
||||||
UNDOCK_VERSION: ${{ matrix.undock_version }}
|
|
||||||
REGCTL_VERSION: ${{ matrix.regctl_version }}
|
|
||||||
|
|
||||||
docker-29:
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os:
|
|
||||||
- ubuntu-latest
|
|
||||||
- macos-15-intel
|
|
||||||
- windows-latest
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
-
|
|
||||||
name: Set up Docker
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
version: v29.0.0-rc.1
|
|
||||||
channel: test
|
|
||||||
|
|
|
||||||
17
.github/workflows/pr-assign-author.yml
vendored
17
.github/workflows/pr-assign-author.yml
vendored
|
|
@ -1,17 +0,0 @@
|
||||||
name: pr-assign-author
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request_target:
|
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
- reopened
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
run:
|
|
||||||
uses: crazy-max/.github/.github/workflows/pr-assign-author.yml@1b673f36fad86812f538c1df9794904038a23cbf
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
pull-requests: write
|
|
||||||
2
.github/workflows/publish.yml
vendored
2
.github/workflows/publish.yml
vendored
|
|
@ -15,7 +15,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: Publish
|
name: Publish
|
||||||
uses: actions/publish-immutable-action@v0.0.4
|
uses: actions/publish-immutable-action@v0.0.4
|
||||||
|
|
|
||||||
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
|
|
@ -15,9 +15,6 @@ jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
-
|
-
|
||||||
name: Test
|
name: Test
|
||||||
uses: docker/bake-action@v6
|
uses: docker/bake-action@v6
|
||||||
|
|
@ -27,6 +24,5 @@ jobs:
|
||||||
name: Upload coverage
|
name: Upload coverage
|
||||||
uses: codecov/codecov-action@v5
|
uses: codecov/codecov-action@v5
|
||||||
with:
|
with:
|
||||||
source: .
|
|
||||||
files: ./coverage/clover.xml
|
files: ./coverage/clover.xml
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|
|
||||||
2
.github/workflows/validate.yml
vendored
2
.github/workflows/validate.yml
vendored
|
|
@ -19,7 +19,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v4
|
||||||
-
|
-
|
||||||
name: List targets
|
name: List targets
|
||||||
id: generate
|
id: generate
|
||||||
|
|
|
||||||
20
README.md
20
README.md
|
|
@ -113,17 +113,15 @@ jobs:
|
||||||
|
|
||||||
The following inputs can be used as `step.with` keys
|
The following inputs can be used as `step.with` keys
|
||||||
|
|
||||||
| Name | Type | Default | Description |
|
| Name | Type | Default | Description |
|
||||||
|-------------------|--------|------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|-----------------|--------|-----------------------|-----------------------------------------------------------------------------------------------------------------------------|
|
||||||
| `version` | String | `latest` | Docker version to use. See [inputs.version](#inputs.version). |
|
| `version` | String | `latest` | Docker version to use. See [inputs.version](#inputs.version). |
|
||||||
| `channel` | String | `stable` | Docker CE [channel](https://download.docker.com/linux/static/) (`stable` or `test`). Only applicable to `type=archive` |
|
| `channel` | String | `stable` | Docker CE [channel](https://download.docker.com/linux/static/) (`stable` or `test`). Only applicable to `type=archive` |
|
||||||
| `daemon-config` | String | | [Docker daemon JSON configuration](https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file) |
|
| `daemon-config` | String | | [Docker daemon JSON configuration](https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file) |
|
||||||
| `tcp-port` | Number | | TCP port to expose the Docker API locally |
|
| `tcp-port` | Number | | TCP port to expose the Docker API locally |
|
||||||
| `context` | String | `setup-docker-action` | Docker context name. |
|
| `context` | String | `setup-docker-action` | Docker context name. |
|
||||||
| `set-host` | Bool | `false` | Set `DOCKER_HOST` environment variable to docker socket path. |
|
| `set-host` | Bool | `false` | Set `DOCKER_HOST` environment variable to docker socket path. |
|
||||||
| `rootless` | Bool | `false` | Start daemon in rootless mode |
|
| `rootless` | Bool | `false` | Start daemon in rootless mode |
|
||||||
| `runtime-basedir` | String | `<home>/setup-docker-action` | Docker runtime base directory |
|
|
||||||
| `github-token` | String | `${{ github.token }}` | Optional GitHub Token used to get releases and download assets to avoid rate limitation. On GitHub Enterprise, you might need to set a PAT for `github.com`. |
|
|
||||||
|
|
||||||
### inputs.version
|
### inputs.version
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
import {beforeEach, describe, expect, test} from '@jest/globals';
|
import {beforeEach, describe, expect, test} from '@jest/globals';
|
||||||
import * as os from 'os';
|
|
||||||
import * as path from 'path';
|
|
||||||
|
|
||||||
import * as context from '../src/context';
|
import * as context from '../src/context';
|
||||||
|
|
||||||
|
|
@ -32,9 +30,7 @@ describe('getInputs', () => {
|
||||||
context: '',
|
context: '',
|
||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
rootless: false,
|
rootless: false,
|
||||||
setHost: false,
|
setHost: false
|
||||||
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
|
||||||
githubToken: '',
|
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -56,9 +52,7 @@ describe('getInputs', () => {
|
||||||
context: 'foo',
|
context: 'foo',
|
||||||
daemonConfig: `{"debug":true,"features":{"containerd-snapshotter":true}}`,
|
daemonConfig: `{"debug":true,"features":{"containerd-snapshotter":true}}`,
|
||||||
rootless: false,
|
rootless: false,
|
||||||
setHost: false,
|
setHost: false
|
||||||
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
|
||||||
githubToken: '',
|
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -76,9 +70,7 @@ describe('getInputs', () => {
|
||||||
context: '',
|
context: '',
|
||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
rootless: false,
|
rootless: false,
|
||||||
setHost: true,
|
setHost: true
|
||||||
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
|
||||||
githubToken: '',
|
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -98,9 +90,7 @@ describe('getInputs', () => {
|
||||||
context: 'foo',
|
context: 'foo',
|
||||||
daemonConfig: `{"debug":true,"features":{"containerd-snapshotter":true}}`,
|
daemonConfig: `{"debug":true,"features":{"containerd-snapshotter":true}}`,
|
||||||
rootless: false,
|
rootless: false,
|
||||||
setHost: false,
|
setHost: false
|
||||||
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
|
||||||
githubToken: '',
|
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -118,9 +108,7 @@ describe('getInputs', () => {
|
||||||
context: '',
|
context: '',
|
||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
rootless: false,
|
rootless: false,
|
||||||
setHost: false,
|
setHost: false
|
||||||
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
|
||||||
githubToken: '',
|
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -140,8 +128,6 @@ describe('getInputs', () => {
|
||||||
context: '',
|
context: '',
|
||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
rootless: false,
|
rootless: false,
|
||||||
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
|
||||||
githubToken: '',
|
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -161,8 +147,6 @@ describe('getInputs', () => {
|
||||||
context: '',
|
context: '',
|
||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
rootless: false,
|
rootless: false,
|
||||||
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
|
||||||
githubToken: '',
|
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -181,8 +165,6 @@ describe('getInputs', () => {
|
||||||
context: '',
|
context: '',
|
||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
rootless: false,
|
rootless: false,
|
||||||
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
|
||||||
githubToken: '',
|
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -201,8 +183,6 @@ describe('getInputs', () => {
|
||||||
context: '',
|
context: '',
|
||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
rootless: true,
|
rootless: true,
|
||||||
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
|
||||||
githubToken: '',
|
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
|
@ -223,9 +203,7 @@ describe('getInputs', () => {
|
||||||
daemonConfig: '',
|
daemonConfig: '',
|
||||||
tcpPort: 2378,
|
tcpPort: 2378,
|
||||||
rootless: false,
|
rootless: false,
|
||||||
setHost: false,
|
setHost: false
|
||||||
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
|
|
||||||
githubToken: '',
|
|
||||||
} as context.Inputs
|
} as context.Inputs
|
||||||
],
|
],
|
||||||
])(
|
])(
|
||||||
|
|
|
||||||
|
|
@ -31,13 +31,6 @@ inputs:
|
||||||
description: 'Enable Docker rootless mode'
|
description: 'Enable Docker rootless mode'
|
||||||
default: 'false'
|
default: 'false'
|
||||||
required: false
|
required: false
|
||||||
runtime-basedir:
|
|
||||||
description: 'Docker runtime base directory'
|
|
||||||
required: false
|
|
||||||
github-token:
|
|
||||||
description: "GitHub Token used to get releases and download assets"
|
|
||||||
default: ${{ github.token }}
|
|
||||||
required: false
|
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
sock:
|
sock:
|
||||||
|
|
|
||||||
30
dist/index.js
generated
vendored
30
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
|
|
@ -27,7 +27,7 @@
|
||||||
"packageManager": "yarn@3.6.3",
|
"packageManager": "yarn@3.6.3",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.11.1",
|
"@actions/core": "^1.11.1",
|
||||||
"@docker/actions-toolkit": "^0.69.0"
|
"@docker/actions-toolkit": "^0.56.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^20.6.0",
|
"@types/node": "^20.6.0",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
import os from 'os';
|
|
||||||
import path from 'path';
|
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import {parse} from 'csv-parse/sync';
|
import {parse} from 'csv-parse/sync';
|
||||||
|
|
||||||
|
|
@ -13,8 +11,6 @@ export interface Inputs {
|
||||||
context: string;
|
context: string;
|
||||||
setHost: boolean;
|
setHost: boolean;
|
||||||
rootless: boolean;
|
rootless: boolean;
|
||||||
runtimeBasedir: string;
|
|
||||||
githubToken: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getInputs(): Inputs {
|
export function getInputs(): Inputs {
|
||||||
|
|
@ -31,9 +27,7 @@ export function getInputs(): Inputs {
|
||||||
tcpPort: Util.getInputNumber('tcp-port'),
|
tcpPort: Util.getInputNumber('tcp-port'),
|
||||||
context: core.getInput('context'),
|
context: core.getInput('context'),
|
||||||
setHost: core.getBooleanInput('set-host'),
|
setHost: core.getBooleanInput('set-host'),
|
||||||
rootless: core.getBooleanInput('rootless'),
|
rootless: core.getBooleanInput('rootless')
|
||||||
runtimeBasedir: core.getInput('runtime-basedir') || path.join(os.homedir(), `setup-docker-action`),
|
|
||||||
githubToken: core.getInput('github-token')
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
34
src/main.ts
34
src/main.ts
|
|
@ -1,51 +1,24 @@
|
||||||
import * as crypto from 'crypto';
|
import * as crypto from 'crypto';
|
||||||
|
import os from 'os';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as actionsToolkit from '@docker/actions-toolkit';
|
import * as actionsToolkit from '@docker/actions-toolkit';
|
||||||
import {Install} from '@docker/actions-toolkit/lib/docker/install';
|
import {Install} from '@docker/actions-toolkit/lib/docker/install';
|
||||||
import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
|
import {Docker} from '@docker/actions-toolkit/lib/docker/docker';
|
||||||
import {Install as RegclientInstall} from '@docker/actions-toolkit/lib/regclient/install';
|
|
||||||
import {Install as UndockInstall} from '@docker/actions-toolkit/lib/undock/install';
|
|
||||||
|
|
||||||
import * as context from './context';
|
import * as context from './context';
|
||||||
import * as stateHelper from './state-helper';
|
import * as stateHelper from './state-helper';
|
||||||
|
|
||||||
const regctlDefaultVersion = 'v0.8.3';
|
|
||||||
const undockDefaultVersion = 'v0.10.0';
|
|
||||||
|
|
||||||
actionsToolkit.run(
|
actionsToolkit.run(
|
||||||
// main
|
// main
|
||||||
async () => {
|
async () => {
|
||||||
const input: context.Inputs = context.getInputs();
|
const input: context.Inputs = context.getInputs();
|
||||||
const runDir = path.join(input.runtimeBasedir, `run-${crypto.randomUUID().slice(0, 8)}`);
|
const runDir = path.join(os.homedir(), `setup-docker-action-${crypto.randomUUID().slice(0, 8)}`);
|
||||||
|
|
||||||
if (input.context == 'default') {
|
if (input.context == 'default') {
|
||||||
throw new Error(`'default' context cannot be used.`);
|
throw new Error(`'default' context cannot be used.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (input.source.type === 'image') {
|
|
||||||
await core.group(`Download and install regctl`, async () => {
|
|
||||||
const regclientInstall = new RegclientInstall({githubToken: input.githubToken});
|
|
||||||
const regclientBinPath = await regclientInstall.download(
|
|
||||||
process.env.REGCTL_VERSION && process.env.REGCTL_VERSION.trim()
|
|
||||||
? process.env.REGCTL_VERSION
|
|
||||||
: regctlDefaultVersion,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
await regclientInstall.install(regclientBinPath);
|
|
||||||
});
|
|
||||||
await core.group(`Download and install undock`, async () => {
|
|
||||||
const undockInstall = new UndockInstall({githubToken: input.githubToken});
|
|
||||||
const undockBinPath = await undockInstall.download(
|
|
||||||
process.env.UNDOCK_VERSION && process.env.UNDOCK_VERSION.trim()
|
|
||||||
? process.env.UNDOCK_VERSION
|
|
||||||
: undockDefaultVersion,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
await undockInstall.install(undockBinPath);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
let tcpPort: number | undefined;
|
let tcpPort: number | undefined;
|
||||||
let tcpAddress: string | undefined;
|
let tcpAddress: string | undefined;
|
||||||
if (input.tcpPort) {
|
if (input.tcpPort) {
|
||||||
|
|
@ -59,8 +32,7 @@ actionsToolkit.run(
|
||||||
rootless: input.rootless,
|
rootless: input.rootless,
|
||||||
contextName: input.context || 'setup-docker-action',
|
contextName: input.context || 'setup-docker-action',
|
||||||
daemonConfig: input.daemonConfig,
|
daemonConfig: input.daemonConfig,
|
||||||
localTCPPort: tcpPort,
|
localTCPPort: tcpPort
|
||||||
githubToken: input.githubToken
|
|
||||||
});
|
});
|
||||||
let toolDir;
|
let toolDir;
|
||||||
if (!(await Docker.isAvailable()) || input.source) {
|
if (!(await Docker.isAvailable()) || input.source) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue