mirror of
https://github.com/docker/setup-docker-action.git
synced 2025-04-19 07:10:02 +02:00
initial implementation
This commit is contained in:
parent
dab70f21b3
commit
845a3c6c45
15
.editorconfig
Normal file
15
.editorconfig
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# This file is for unifying the coding style for different editors and IDEs.
|
||||||
|
# More information at http://editorconfig.org
|
||||||
|
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
23
.eslintrc.json
Normal file
23
.eslintrc.json
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"node": true,
|
||||||
|
"es2021": true,
|
||||||
|
"jest": true
|
||||||
|
},
|
||||||
|
"extends": [
|
||||||
|
"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"
|
||||||
|
]
|
||||||
|
}
|
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/dist/** linguist-generated=true
|
||||||
|
/lib/** linguist-generated=true
|
91
.gitignore
vendored
Normal file
91
.gitignore
vendored
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
node_modules
|
||||||
|
lib
|
||||||
|
|
||||||
|
# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
|
||||||
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
*.lcov
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# TypeScript v1 declaration files
|
||||||
|
typings/
|
||||||
|
|
||||||
|
# TypeScript cache
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variables file
|
||||||
|
.env
|
||||||
|
.env.test
|
||||||
|
|
||||||
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
|
.cache
|
||||||
|
|
||||||
|
# next.js build output
|
||||||
|
.next
|
||||||
|
|
||||||
|
# nuxt.js build output
|
||||||
|
.nuxt
|
||||||
|
|
||||||
|
# vuepress build output
|
||||||
|
.vuepress/dist
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless/
|
||||||
|
|
||||||
|
# FuseBox cache
|
||||||
|
.fusebox/
|
||||||
|
|
||||||
|
# DynamoDB Local files
|
||||||
|
.dynamodb/
|
11
.prettierrc.json
Normal file
11
.prettierrc.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"printWidth": 120,
|
||||||
|
"tabWidth": 2,
|
||||||
|
"useTabs": false,
|
||||||
|
"semi": true,
|
||||||
|
"singleQuote": true,
|
||||||
|
"trailingComma": "none",
|
||||||
|
"bracketSpacing": false,
|
||||||
|
"arrowParens": "avoid",
|
||||||
|
"parser": "typescript"
|
||||||
|
}
|
16
action.yml
Normal file
16
action.yml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# https://help.github.com/en/articles/metadata-syntax-for-github-actions
|
||||||
|
name: 'Docker Setup Docker'
|
||||||
|
description: 'Set up Docker'
|
||||||
|
author: 'docker'
|
||||||
|
branding:
|
||||||
|
icon: 'anchor'
|
||||||
|
color: 'blue'
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
description: 'Docker CE version. (e.g, 23.0.1)'
|
||||||
|
required: false
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: 'node16'
|
||||||
|
main: 'dist/index.js'
|
48
package.json
Normal file
48
package.json
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
"name": "docker-setup-docker",
|
||||||
|
"description": "Set up Docker CE",
|
||||||
|
"main": "lib/main.js",
|
||||||
|
"scripts": {
|
||||||
|
"build": "ncc build src/main.ts --source-map --minify --license licenses.txt",
|
||||||
|
"lint": "eslint src/**/*.ts __tests__/**/*.ts",
|
||||||
|
"format": "eslint --fix src/**/*.ts __tests__/**/*.ts",
|
||||||
|
"test": "jest --coverage",
|
||||||
|
"all": "yarn run build && yarn run format && yarn test"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/crazy-max/ghaction-setup-docker.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"actions",
|
||||||
|
"docker",
|
||||||
|
"engine"
|
||||||
|
],
|
||||||
|
"author": "Docker",
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "CrazyMax",
|
||||||
|
"url": "https://crazymax.dev"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"@actions/core": "^1.10.0",
|
||||||
|
"@docker/actions-toolkit": "link:../../docker_org/actions/docker-actions-toolkit"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^16.11.26",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^5.14.0",
|
||||||
|
"@typescript-eslint/parser": "^5.14.0",
|
||||||
|
"@vercel/ncc": "^0.33.3",
|
||||||
|
"eslint": "^8.11.0",
|
||||||
|
"eslint-config-prettier": "^8.5.0",
|
||||||
|
"eslint-plugin-jest": "^26.1.1",
|
||||||
|
"eslint-plugin-prettier": "^4.0.0",
|
||||||
|
"jest": "^27.2.5",
|
||||||
|
"prettier": "^2.3.1",
|
||||||
|
"ts-jest": "^27.1.2",
|
||||||
|
"ts-node": "^10.7.0",
|
||||||
|
"typescript": "^4.4.4"
|
||||||
|
}
|
||||||
|
}
|
11
src/context.ts
Normal file
11
src/context.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import * as core from '@actions/core';
|
||||||
|
|
||||||
|
export interface Inputs {
|
||||||
|
version: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getInputs(): Inputs {
|
||||||
|
return {
|
||||||
|
version: core.getInput('version')
|
||||||
|
};
|
||||||
|
}
|
30
src/main.ts
Normal file
30
src/main.ts
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import * as context from './context';
|
||||||
|
import * as core from '@actions/core';
|
||||||
|
import * as actionsToolkit from '@docker/actions-toolkit';
|
||||||
|
|
||||||
|
import {Install} from '../../../docker_org/actions/docker-actions-toolkit/lib/docker/install';
|
||||||
|
import {Context} from '../../../docker_org/actions/docker-actions-toolkit/lib/context';
|
||||||
|
import {Docker} from '../../../docker_org/actions/docker-actions-toolkit/lib/docker/docker';
|
||||||
|
|
||||||
|
actionsToolkit.run(
|
||||||
|
// main
|
||||||
|
async () => {
|
||||||
|
const input: context.Inputs = context.getInputs();
|
||||||
|
const install = new Install();
|
||||||
|
|
||||||
|
let toolDir;
|
||||||
|
if (!(await Docker.isAvailable()) || input.version) {
|
||||||
|
await core.group(`Download docker`, async () => {
|
||||||
|
toolDir = await install.download(input.version || 'latest');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (toolDir) {
|
||||||
|
await install.install(toolDir, Context.tmpDir(), input.version);
|
||||||
|
}
|
||||||
|
|
||||||
|
await core.group(`Docker info`, async () => {
|
||||||
|
await Docker.printVersion();
|
||||||
|
await Docker.printInfo();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
21
tsconfig.json
Normal file
21
tsconfig.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"target": "es6",
|
||||||
|
"module": "commonjs",
|
||||||
|
"strict": true,
|
||||||
|
"newLine": "lf",
|
||||||
|
"outDir": "./lib",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"noImplicitAny": false,
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"useUnknownInCatchVariables": false,
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"./__tests__/**/*",
|
||||||
|
"./lib/**/*",
|
||||||
|
"node_modules",
|
||||||
|
"jest.config.ts"
|
||||||
|
]
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user