Compare commits

..

47 Commits

Author SHA1 Message Date
CrazyMax
1a6edb0ba9 Merge pull request #215 from crazy-max/node24
node 24 as default runtime
2026-03-02 18:02:06 +01:00
CrazyMax
1c63d0a9bc node 24 as default runtime
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-03-02 14:57:51 +01:00
CrazyMax
36efcb97db Merge pull request #214 from crazy-max/fix-vendoring
dockerfile: fix vendoring
2026-03-02 11:08:58 +01:00
CrazyMax
61e47f647f Merge pull request #213 from crazy-max/update-yarn
update yarn to 4.9.2
2026-03-02 11:08:34 +01:00
CrazyMax
64e9804c90 dockerfile: fix vendoring
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-03-02 09:48:17 +01:00
CrazyMax
ca54cb1e9e update yarn to 4.9.2
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-02-28 01:36:01 +01:00
CrazyMax
2d1c601523 Merge pull request #209 from docker/dependabot/npm_and_yarn/fast-xml-parser-5.3.6
build(deps): bump fast-xml-parser from 5.3.4 to 5.4.1
2026-02-28 01:06:42 +01:00
CrazyMax
87e5e87f0e Merge pull request #208 from docker/dependabot/npm_and_yarn/isaacs/brace-expansion-5.0.1
build(deps): bump @isaacs/brace-expansion from 5.0.0 to 5.0.1
2026-02-28 00:59:06 +01:00
github-actions[bot]
c5620aed45 chore: update generated content 2026-02-27 23:54:32 +00:00
dependabot[bot]
76747bc859 build(deps): bump fast-xml-parser from 5.3.4 to 5.3.6
Bumps [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) from 5.3.4 to 5.3.6.
- [Release notes](https://github.com/NaturalIntelligence/fast-xml-parser/releases)
- [Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/NaturalIntelligence/fast-xml-parser/compare/v5.3.4...v5.3.6)

---
updated-dependencies:
- dependency-name: fast-xml-parser
  dependency-version: 5.3.6
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-27 23:53:20 +00:00
dependabot[bot]
ba311ac264 build(deps): bump @isaacs/brace-expansion from 5.0.0 to 5.0.1
Bumps @isaacs/brace-expansion from 5.0.0 to 5.0.1.

---
updated-dependencies:
- dependency-name: "@isaacs/brace-expansion"
  dependency-version: 5.0.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-27 23:48:31 +00:00
CrazyMax
817f81dc01 Merge pull request #204 from docker/dependabot/npm_and_yarn/docker/actions-toolkit-0.76.0
build(deps): bump @docker/actions-toolkit from 0.71.0 to 0.77.0
2026-02-28 00:46:26 +01:00
github-actions[bot]
f524fc8e8f chore: update generated content 2026-02-27 23:28:40 +00:00
dependabot[bot]
d628ef03a6 build(deps): bump @docker/actions-toolkit from 0.71.0 to 0.76.0
Bumps [@docker/actions-toolkit](https://github.com/docker/actions-toolkit) from 0.71.0 to 0.76.0.
- [Release notes](https://github.com/docker/actions-toolkit/releases)
- [Commits](https://github.com/docker/actions-toolkit/compare/v0.71.0...v0.76.0)

---
updated-dependencies:
- dependency-name: "@docker/actions-toolkit"
  dependency-version: 0.76.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-27 23:27:25 +00:00
CrazyMax
bd87803de9 Merge pull request #205 from docker/dependabot/npm_and_yarn/actions/core-3.0.0
build(deps): bump @actions/core from 2.0.1 to 3.0.0
2026-02-28 00:25:31 +01:00
github-actions[bot]
d758fac2f6 chore: update generated content 2026-02-27 23:00:39 +00:00
dependabot[bot]
994ca6a470 build(deps): bump @actions/core from 2.0.1 to 3.0.0
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 2.0.1 to 3.0.0.
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-version: 3.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-02-27 22:59:23 +00:00
CrazyMax
567531d87b Merge pull request #212 from crazy-max/esm
switch to ESM and update config/test wiring
2026-02-27 23:56:39 +01:00
CrazyMax
9ba91cefb5 chore: update generated content
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-02-27 18:32:01 +01:00
CrazyMax
73dd80d85e update dev dependencies
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-02-27 18:29:32 +01:00
CrazyMax
6d927c4c13 switch to ESM and update config/test wiring
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-02-27 18:28:51 +01:00
CrazyMax
48428700fb switch from jest to vitest
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-02-27 18:24:25 +01:00
CrazyMax
206b75dbd2 Merge pull request #207 from docker/dependabot/npm_and_yarn/fast-xml-parser-5.3.4
build(deps): bump fast-xml-parser from 5.3.3 to 5.3.4
2026-02-02 17:32:23 +01:00
github-actions[bot]
c5226a330b chore: update generated content 2026-01-30 23:14:52 +00:00
dependabot[bot]
7ca7d98ba6 build(deps): bump fast-xml-parser from 5.3.3 to 5.3.4
Bumps [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) from 5.3.3 to 5.3.4.
- [Release notes](https://github.com/NaturalIntelligence/fast-xml-parser/releases)
- [Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md)
- [Commits](https://github.com/NaturalIntelligence/fast-xml-parser/compare/v5.3.3...v5.3.4)

---
updated-dependencies:
- dependency-name: fast-xml-parser
  dependency-version: 5.3.4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-30 23:13:34 +00:00
CrazyMax
44cc003740 Merge pull request #202 from docker/dependabot/npm_and_yarn/lodash-4.17.23
build(deps): bump lodash from 4.17.21 to 4.17.23
2026-01-29 18:01:32 +01:00
CrazyMax
992974e691 Merge pull request #206 from crazy-max/update-dist-workflow
ci: update-dist workflow
2026-01-29 17:50:19 +01:00
CrazyMax
1d3903993e ci: update-dist workflow
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-01-29 16:27:39 +01:00
dependabot[bot]
dabbf8396d build(deps): bump lodash from 4.17.21 to 4.17.23
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.21 to 4.17.23.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.21...4.17.23)

---
updated-dependencies:
- dependency-name: lodash
  dependency-version: 4.17.23
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-22 01:47:12 +00:00
Paweł Gronowski
e43656e248 Merge pull request #193 from docker/dependabot/npm_and_yarn/docker/actions-toolkit-0.71.0
build(deps): bump @docker/actions-toolkit from 0.69.0 to 0.71.0
2025-12-19 15:08:37 +00:00
CrazyMax
51b16473d8 chore: update generated content
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-12-19 15:47:58 +01:00
dependabot[bot]
34fbc53a71 build(deps): bump @docker/actions-toolkit from 0.69.0 to 0.71.0
Bumps [@docker/actions-toolkit](https://github.com/docker/actions-toolkit) from 0.69.0 to 0.71.0.
- [Release notes](https://github.com/docker/actions-toolkit/releases)
- [Commits](https://github.com/docker/actions-toolkit/compare/v0.69.0...v0.71.0)

---
updated-dependencies:
- dependency-name: "@docker/actions-toolkit"
  dependency-version: 0.71.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-19 13:51:44 +00:00
CrazyMax
ec52bdf18d Merge pull request #196 from docker/dependabot/npm_and_yarn/js-yaml-3.14.2
build(deps): bump js-yaml from 3.14.1 to 3.14.2
2025-12-19 14:49:38 +01:00
Paweł Gronowski
c2e06996ea Merge pull request #192 from docker/dependabot/npm_and_yarn/actions/core-2.0.1
build(deps): bump @actions/core from 1.11.1 to 2.0.1
2025-12-19 13:28:29 +00:00
CrazyMax
02a35a12bc chore: update generated content
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-12-19 13:31:18 +01:00
dependabot[bot]
1d30751f7d build(deps): bump js-yaml from 3.14.1 to 3.14.2
Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.14.1 to 3.14.2.
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/3.14.1...3.14.2)

---
updated-dependencies:
- dependency-name: js-yaml
  dependency-version: 3.14.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-19 12:30:01 +00:00
dependabot[bot]
20e0c03a8d build(deps): bump @actions/core from 1.11.1 to 2.0.1
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.11.1 to 2.0.1.
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/@actions/artifact@2.0.1/packages/core)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-version: 2.0.1
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-19 12:28:32 +00:00
CrazyMax
069eb67b1b Merge pull request #194 from crazy-max/update-dev-deps
update dev dependencies
2025-12-19 13:23:13 +01:00
CrazyMax
c17c6939ae chore: update generated content
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-12-19 10:29:49 +01:00
CrazyMax
42e161ad30 update jest config since 30.0
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-12-19 10:25:42 +01:00
CrazyMax
37fd203c16 migrate eslint config to new format required since 9.0.0
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-12-19 10:23:58 +01:00
CrazyMax
c33cda087a update dev dependencies
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-12-19 10:15:30 +01:00
CrazyMax
714148933e Merge pull request #190 from docker/dependabot/npm_and_yarn/docker/actions-toolkit-0.69.0
build(deps): bump @docker/actions-toolkit from 0.68.0 to 0.69.0
2025-12-03 10:00:58 +01:00
CrazyMax
56702790ee chore: update generated content
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-12-02 18:55:30 +01:00
dependabot[bot]
b989044537 build(deps): bump @docker/actions-toolkit from 0.68.0 to 0.69.0
Bumps [@docker/actions-toolkit](https://github.com/docker/actions-toolkit) from 0.68.0 to 0.69.0.
- [Release notes](https://github.com/docker/actions-toolkit/releases)
- [Commits](https://github.com/docker/actions-toolkit/compare/v0.68.0...v0.69.0)

---
updated-dependencies:
- dependency-name: "@docker/actions-toolkit"
  dependency-version: 0.69.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-02 16:43:22 +00:00
CrazyMax
f2e530b12f Merge pull request #185 from polarctos/patch-1
Add github-token input to readme
2025-11-28 16:28:47 +01:00
polarctos
db7d380101 Add github-token input to readme
Signed-off-by: polarctos <polarctos@users.noreply.github.com>
2025-11-28 15:58:12 +01:00
25 changed files with 2890 additions and 8613 deletions

View File

@@ -1,3 +0,0 @@
/dist/**
/coverage/**
/node_modules/**

View File

@@ -1,24 +0,0 @@
{
"env": {
"node": true,
"es6": true,
"jest": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"jest",
"prettier"
]
}

49
.github/workflows/update-dist.yml vendored Normal file
View File

@@ -0,0 +1,49 @@
name: update-dist
on:
pull_request:
types:
- opened
- synchronize
jobs:
update-dist:
if: github.actor == 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
-
name: GitHub auth token from GitHub App
id: docker-read-app
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.GHACTIONS_REPO_WRITE_APP_ID }}
private-key: ${{ secrets.GHACTIONS_REPO_WRITE_APP_PRIVATE_KEY }}
owner: docker
-
name: Checkout
uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
token: ${{ steps.docker-read-app.outputs.token || github.token }}
-
name: Build
uses: docker/bake-action@v6
with:
source: .
targets: build
-
name: Commit and push dist
run: |
if [ -n "$(git status --porcelain -- dist)" ]; then
(
set -x
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add dist
git commit -m "chore: update generated content"
git push
)
else
echo "No changes in dist"
fi

View File

@@ -6,6 +6,5 @@
"singleQuote": true, "singleQuote": true,
"trailingComma": "none", "trailingComma": "none",
"bracketSpacing": false, "bracketSpacing": false,
"arrowParens": "avoid", "arrowParens": "avoid"
"parser": "typescript"
} }

File diff suppressed because one or more lines are too long

View File

@@ -1,3 +1,9 @@
# https://yarnpkg.com/configuration/yarnrc
compressionLevel: mixed
enableGlobalCache: false
enableHardenedMode: true
logFilters: logFilters:
- code: YN0013 - code: YN0013
level: discard level: discard
@@ -5,9 +11,7 @@ logFilters:
level: discard level: discard
- code: YN0076 - code: YN0076
level: discard level: discard
- code: YN0086
level: discard
nodeLinker: node-modules nodeLinker: node-modules
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"

View File

@@ -114,7 +114,7 @@ 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) |
@@ -123,6 +123,7 @@ The following inputs can be used as `step.with` keys
| `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 | | `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

View File

@@ -1,8 +1,8 @@
import {beforeEach, describe, expect, test} from '@jest/globals'; import {beforeEach, describe, expect, test} from 'vitest';
import * as os from 'os'; import * as os from 'os';
import * as path from 'path'; import * as path from 'path';
import * as context from '../src/context'; import * as context from '../src/context.js';
describe('getInputs', () => { describe('getInputs', () => {
beforeEach(() => { beforeEach(() => {
@@ -15,7 +15,7 @@ describe('getInputs', () => {
}); });
// prettier-ignore // prettier-ignore
test.each([ const cases: [number, Map<string, string>, context.Inputs][] = [
[ [
0, 0,
new Map<string, string>([ new Map<string, string>([
@@ -35,7 +35,7 @@ describe('getInputs', () => {
setHost: false, setHost: false,
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`), runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
githubToken: '', githubToken: '',
} as context.Inputs }
], ],
[ [
1, 1,
@@ -59,7 +59,7 @@ describe('getInputs', () => {
setHost: false, setHost: false,
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`), runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
githubToken: '', githubToken: '',
} as context.Inputs }
], ],
[ [
2, 2,
@@ -79,7 +79,7 @@ describe('getInputs', () => {
setHost: true, setHost: true,
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`), runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
githubToken: '', githubToken: '',
} as context.Inputs }
], ],
[ [
3, 3,
@@ -101,7 +101,7 @@ describe('getInputs', () => {
setHost: false, setHost: false,
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`), runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
githubToken: '', githubToken: '',
} as context.Inputs }
], ],
[ [
4, 4,
@@ -121,7 +121,7 @@ describe('getInputs', () => {
setHost: false, setHost: false,
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`), runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
githubToken: '', githubToken: '',
} as context.Inputs }
], ],
[ [
5, 5,
@@ -142,7 +142,7 @@ describe('getInputs', () => {
rootless: false, rootless: false,
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`), runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
githubToken: '', githubToken: '',
} as context.Inputs }
], ],
[ [
6, 6,
@@ -163,7 +163,7 @@ describe('getInputs', () => {
rootless: false, rootless: false,
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`), runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
githubToken: '', githubToken: '',
} as context.Inputs }
], ],
[ [
7, 7,
@@ -183,7 +183,7 @@ describe('getInputs', () => {
rootless: false, rootless: false,
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`), runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
githubToken: '', githubToken: '',
} as context.Inputs }
], ],
[ [
8, 8,
@@ -203,7 +203,7 @@ describe('getInputs', () => {
rootless: true, rootless: true,
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`), runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
githubToken: '', githubToken: '',
} as context.Inputs }
], ],
[ [
9, 9,
@@ -226,10 +226,11 @@ describe('getInputs', () => {
setHost: false, setHost: false,
runtimeBasedir: path.join(os.homedir(), `setup-docker-action`), runtimeBasedir: path.join(os.homedir(), `setup-docker-action`),
githubToken: '', githubToken: '',
} as context.Inputs }
], ],
])( ];
'[%d] given %p as inputs, returns %p', test.each(cases)(
'[%d] given %o as inputs, returns %o',
async (num: number, inputs: Map<string, string>, expected: context.Inputs) => { async (num: number, inputs: Map<string, string>, expected: context.Inputs) => {
inputs.forEach((value: string, name: string) => { inputs.forEach((value: string, name: string) => {
setInput(name, value); setInput(name, value);

12
__tests__/setup.unit.ts Normal file
View File

@@ -0,0 +1,12 @@
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-setup-docker-action-'));
process.env = Object.assign({}, process.env, {
TEMP: tmpDir,
GITHUB_REPOSITORY: 'docker/setup-docker-action',
RUNNER_TEMP: path.join(tmpDir, 'runner-temp'),
RUNNER_TOOL_CACHE: path.join(tmpDir, 'runner-tool-cache')
});

View File

@@ -46,6 +46,6 @@ outputs:
description: "Docker TCP address if tcp-port is set" description: "Docker TCP address if tcp-port is set"
runs: runs:
using: 'node20' using: 'node24'
main: 'dist/index.js' main: 'dist/index.js'
post: 'dist/index.js' post: 'dist/index.js'

View File

@@ -1,12 +1,13 @@
# syntax=docker/dockerfile:1 # syntax=docker/dockerfile:1
ARG NODE_VERSION=20 ARG NODE_VERSION=24
FROM node:${NODE_VERSION}-alpine AS base FROM node:${NODE_VERSION}-alpine AS base
RUN apk add --no-cache cpio findutils git RUN apk add --no-cache cpio findutils git rsync
WORKDIR /src WORKDIR /src
RUN --mount=type=bind,target=.,rw \ RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/.yarn/cache <<EOT --mount=type=cache,target=/src/.yarn/cache <<EOT
set -e
corepack enable corepack enable
yarn --version yarn --version
yarn config set --home enableTelemetry 0 yarn config set --home enableTelemetry 0
@@ -27,25 +28,34 @@ RUN --mount=type=bind,target=.,rw <<EOT
git add -A git add -A
cp -rf /vendor/* . cp -rf /vendor/* .
if [ -n "$(git status --porcelain -- yarn.lock)" ]; then if [ -n "$(git status --porcelain -- yarn.lock)" ]; then
echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor-update"' echo >&2 'ERROR: Vendor result differs. Please vendor your package with "docker buildx bake vendor"'
git status --porcelain -- yarn.lock git status --porcelain -- yarn.lock
exit 1 exit 1
fi fi
EOT EOT
FROM deps AS build FROM deps AS build
RUN --mount=type=bind,target=.,rw \ RUN --mount=target=/context \
--mount=type=cache,target=/src/.yarn/cache \ --mount=type=cache,target=/src/.yarn/cache \
--mount=type=cache,target=/src/node_modules \ --mount=type=cache,target=/src/node_modules <<EOT
yarn run build && mkdir /out && cp -Rf dist /out/ set -e
rsync -a /context/. .
rm -rf dist
yarn run build
mkdir /out
cp -r dist /out
EOT
FROM scratch AS build-update FROM scratch AS build-update
COPY --from=build /out / COPY --from=build /out /
FROM build AS build-validate FROM build AS build-validate
RUN --mount=type=bind,target=.,rw <<EOT RUN --mount=target=/context \
--mount=target=.,type=tmpfs <<EOT
set -e set -e
rsync -a /context/. .
git add -A git add -A
rm -rf dist
cp -rf /out/* . cp -rf /out/* .
if [ -n "$(git status --porcelain -- dist)" ]; then if [ -n "$(git status --porcelain -- dist)" ]; then
echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"' echo >&2 'ERROR: Build result differs. Please build first with "docker buildx bake build"'
@@ -58,8 +68,7 @@ FROM deps AS format
RUN --mount=type=bind,target=.,rw \ RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/.yarn/cache \ --mount=type=cache,target=/src/.yarn/cache \
--mount=type=cache,target=/src/node_modules \ --mount=type=cache,target=/src/node_modules \
yarn run format \ yarn run format && mkdir /out && find . -name '*.ts' -not -path './node_modules/*' -not -path './.yarn/*' | cpio -pdm /out
&& mkdir /out && find . -name '*.ts' -not -path './node_modules/*' | cpio -pdm /out
FROM scratch AS format-update FROM scratch AS format-update
COPY --from=format /out / COPY --from=format /out /
@@ -74,7 +83,7 @@ FROM deps AS test
RUN --mount=type=bind,target=.,rw \ RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/.yarn/cache \ --mount=type=cache,target=/src/.yarn/cache \
--mount=type=cache,target=/src/node_modules \ --mount=type=cache,target=/src/node_modules \
yarn run test --coverage --coverageDirectory=/tmp/coverage yarn run test --coverage --coverage.reportsDirectory=/tmp/coverage
FROM scratch AS test-coverage FROM scratch AS test-coverage
COPY --from=test /tmp/coverage / COPY --from=test /tmp/coverage /

105
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

2626
dist/licenses.txt generated vendored

File diff suppressed because it is too large Load Diff

3
dist/package.json generated vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"type": "module"
}

1
dist/sourcemap-register.cjs generated vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/sourcemap-register.js generated vendored

File diff suppressed because one or more lines are too long

52
eslint.config.mjs Normal file
View File

@@ -0,0 +1,52 @@
import {defineConfig} from 'eslint/config';
import js from '@eslint/js';
import tseslint from '@typescript-eslint/eslint-plugin';
import vitest from '@vitest/eslint-plugin';
import globals from 'globals';
import eslintConfigPrettier from 'eslint-config-prettier/flat';
import eslintPluginPrettier from 'eslint-plugin-prettier';
export default defineConfig([
{
ignores: ['.yarn/**/*', 'coverage/**/*', 'dist/**/*']
},
js.configs.recommended,
...tseslint.configs['flat/recommended'],
eslintConfigPrettier,
{
languageOptions: {
globals: {
...globals.node
}
}
},
{
files: ['__tests__/**'],
...vitest.configs.recommended,
languageOptions: {
globals: {
...globals.node,
...vitest.environments.env.globals
}
},
rules: {
...vitest.configs.recommended.rules,
'vitest/no-conditional-expect': 'error',
'vitest/no-disabled-tests': 0
}
},
{
plugins: {
prettier: eslintPluginPrettier
},
rules: {
'prettier/prettier': 'error',
'@typescript-eslint/no-require-imports': [
'error',
{
allowAsImport: true
}
]
}
}
]);

View File

@@ -1,30 +0,0 @@
import fs from 'fs';
import os from 'os';
import path from 'path';
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-setup-docker-action-'));
process.env = Object.assign({}, process.env, {
TEMP: tmpDir,
GITHUB_REPOSITORY: 'docker/setup-docker-action',
RUNNER_TEMP: path.join(tmpDir, 'runner-temp'),
RUNNER_TOOL_CACHE: path.join(tmpDir, 'runner-tool-cache')
}) as {
[key: string]: string;
};
module.exports = {
clearMocks: true,
testEnvironment: 'node',
moduleFileExtensions: ['js', 'ts'],
testMatch: ['**/*.test.ts'],
transform: {
'^.+\\.ts$': 'ts-jest'
},
moduleNameMapper: {
'^csv-parse/sync': '<rootDir>/node_modules/csv-parse/dist/cjs/sync.cjs'
},
collectCoverageFrom: ['src/**/{!(main.ts),}.ts'],
coveragePathIgnorePatterns: ['lib/', 'node_modules/', '__mocks__/', '__tests__/'],
verbose: true
};

View File

@@ -1,16 +1,13 @@
{ {
"name": "docker-setup-docker", "name": "docker-setup-docker",
"description": "Set up Docker for use in GitHub Actions by downloading and installing a version of Docker CE", "description": "Set up Docker for use in GitHub Actions by downloading and installing a version of Docker CE",
"main": "lib/main.js", "type": "module",
"main": "src/main.ts",
"scripts": { "scripts": {
"build": "ncc build src/main.ts --source-map --minify --license licenses.txt", "build": "ncc build src/main.ts --source-map --minify --license licenses.txt",
"lint": "yarn run prettier && yarn run eslint", "lint": "eslint --max-warnings=0 .",
"format": "yarn run prettier:fix && yarn run eslint:fix", "format": "eslint --fix .",
"eslint": "eslint --max-warnings=0 .", "test": "vitest run",
"eslint:fix": "eslint --fix .",
"prettier": "prettier --check \"./**/*.ts\"",
"prettier:fix": "prettier --write \"./**/*.ts\"",
"test": "jest",
"all": "yarn run build && yarn run format && yarn test" "all": "yarn run build && yarn run format && yarn test"
}, },
"repository": { "repository": {
@@ -24,24 +21,25 @@
], ],
"author": "Docker Inc.", "author": "Docker Inc.",
"license": "Apache-2.0", "license": "Apache-2.0",
"packageManager": "yarn@3.6.3", "packageManager": "yarn@4.9.2",
"dependencies": { "dependencies": {
"@actions/core": "^1.11.1", "@actions/core": "^3.0.0",
"@docker/actions-toolkit": "^0.68.0" "@docker/actions-toolkit": "^0.77.0"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^20.6.0", "@eslint/js": "^9.39.3",
"@typescript-eslint/eslint-plugin": "^6.6.0", "@types/node": "^24.11.0",
"@typescript-eslint/parser": "^6.6.0", "@typescript-eslint/eslint-plugin": "^8.56.1",
"@vercel/ncc": "^0.38.0", "@typescript-eslint/parser": "^8.56.1",
"eslint": "^8.49.0", "@vercel/ncc": "^0.38.4",
"eslint-config-prettier": "^9.0.0", "@vitest/coverage-v8": "^4.0.18",
"eslint-plugin-jest": "^27.2.3", "@vitest/eslint-plugin": "^1.6.9",
"eslint-plugin-prettier": "^5.0.0", "eslint": "^9.39.3",
"jest": "^29.6.4", "eslint-config-prettier": "^10.1.8",
"prettier": "^3.0.3", "eslint-plugin-prettier": "^5.5.5",
"ts-jest": "^29.1.1", "globals": "^17.3.0",
"ts-node": "^10.9.1", "prettier": "^3.8.1",
"typescript": "^5.2.2" "typescript": "^5.9.3",
"vitest": "^4.0.18"
} }
} }

View File

@@ -3,8 +3,8 @@ 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';
import {InstallSource} from '@docker/actions-toolkit/lib/docker/install'; import {InstallSource} from '@docker/actions-toolkit/lib/docker/install.js';
import {Util} from '@docker/actions-toolkit/lib/util'; import {Util} from '@docker/actions-toolkit/lib/util.js';
export interface Inputs { export interface Inputs {
source: InstallSource; source: InstallSource;

View File

@@ -2,13 +2,13 @@ import * as crypto from 'crypto';
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.js';
import {Docker} from '@docker/actions-toolkit/lib/docker/docker'; import {Docker} from '@docker/actions-toolkit/lib/docker/docker.js';
import {Install as RegclientInstall} from '@docker/actions-toolkit/lib/regclient/install'; import {Install as RegclientInstall} from '@docker/actions-toolkit/lib/regclient/install.js';
import {Install as UndockInstall} from '@docker/actions-toolkit/lib/undock/install'; import {Install as UndockInstall} from '@docker/actions-toolkit/lib/undock/install.js';
import * as context from './context'; import * as context from './context.js';
import * as stateHelper from './state-helper'; import * as stateHelper from './state-helper.js';
const regctlDefaultVersion = 'v0.8.3'; const regctlDefaultVersion = 'v0.8.3';
const undockDefaultVersion = 'v0.10.0'; const undockDefaultVersion = 'v0.10.0';

View File

@@ -1,8 +1,8 @@
{ {
"compilerOptions": { "compilerOptions": {
"module": "nodenext",
"moduleResolution": "nodenext",
"esModuleInterop": true, "esModuleInterop": true,
"target": "es6",
"module": "commonjs",
"newLine": "lf", "newLine": "lf",
"outDir": "./lib", "outDir": "./lib",
"rootDir": "./src", "rootDir": "./src",
@@ -11,9 +11,7 @@
"resolveJsonModule": true, "resolveJsonModule": true,
"useUnknownInCatchVariables": false, "useUnknownInCatchVariables": false,
}, },
"exclude": [ "include": [
"node_modules", "src/**/*.ts"
"**/*.test.ts",
"jest.config.ts"
] ]
} }

16
vitest.config.ts Normal file
View File

@@ -0,0 +1,16 @@
import {defineConfig} from 'vitest/config';
export default defineConfig({
test: {
clearMocks: true,
environment: 'node',
setupFiles: ['./__tests__/setup.unit.ts'],
include: ['**/*.test.ts'],
coverage: {
provider: 'v8',
reporter: ['clover'],
include: ['src/**/*.ts'],
exclude: ['src/**/main.ts']
}
}
});

7868
yarn.lock

File diff suppressed because it is too large Load Diff