diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..ae29ccd --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,15 @@ +{ + "env": { + "es6": true, + "node": true + }, + "extends": [ + "standard" + ], + "plugins": [ + "standard" + ], + "parserOptions": { + "ecmaVersion": 2018 + } +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e5386f0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,32 @@ +haters + +lib-cov +*.seed +*.log +*.csv +*.dat +*.out +*.pid +*.gz +.github-todos + +pids +results + +node_modules +npm-debug.log +package-lock.json + +# code coverage folder +coverage +.nyc_output + +# Secrets +.env +.env.** + +# IDEs and editors +.idea +.vscode + +.vagrant diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index a3870cd..0000000 --- a/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM docker:stable -COPY start-redis.sh /start-redis.sh -RUN chmod +x /start-redis.sh -ENTRYPOINT ["/start-redis.sh"] diff --git a/action.yml b/action.yml index c05f125..d4cad76 100644 --- a/action.yml +++ b/action.yml @@ -12,5 +12,5 @@ inputs: default: 'latest' runs: - using: 'docker' - image: 'Dockerfile' + using: 'node12' + main: 'start-redis.js' diff --git a/package.json b/package.json new file mode 100644 index 0000000..c0fc4e4 --- /dev/null +++ b/package.json @@ -0,0 +1,43 @@ +{ + "name": "@supercharge/redis-github-action", + "description": "Redis server in a GitHub Action", + "version": "1.0.0", + "author": "Marcus Pöhls ", + "bugs": { + "url": "https://github.com/superchargejs/redis-github-action/issues" + }, + "dependencies": { + "@actions/core": "~1.2.0", + "@actions/exec": "~1.0.2" + }, + "devDependencies": { + "eslint": "~6.7.2", + "eslint-config-standard": "~14.1.0", + "eslint-plugin-import": "~2.19.1", + "eslint-plugin-node": "~10.0.0", + "eslint-plugin-promise": "~4.2.1", + "eslint-plugin-standard": "~4.0.1" + }, + "engines": { + "node": ">=8" + }, + "homepage": "https://github.com/superchargejs/redis-github-action", + "keywords": [ + "redis", + "github", + "github-action", + "supercharge" + ], + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/superchargejs/redis-github-action.git" + }, + "scripts": { + "lint": "eslint .", + "lint:fix": "eslint . --fix", + "list:tests": "lab --assert @hapi/code --dry --verbose", + "test": "lab --assert @hapi/code --leaks --coverage --lint --reporter console --output stdout --reporter html --output ./coverage/coverage.html", + "test:single": "lab --assert @hapi/code --leaks --lint --id" + } +} diff --git a/start-redis.js b/start-redis.js new file mode 100644 index 0000000..6f38d55 --- /dev/null +++ b/start-redis.js @@ -0,0 +1,8 @@ +const core = require('@actions/core') +const { exec } = require('@actions/exec') + +async function run (){ + await exec(`docker run --name redis --publish 6379:6379 --detach redis:${core.getInput('redis-version')}`) +} + +run() diff --git a/start-redis.sh b/start-redis.sh deleted file mode 100755 index 61495aa..0000000 --- a/start-redis.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh - -sh -c "docker run -p 6379:6379 -d redis:$INPUT_REDIS-VERSION"