use Node.js action

pull/6/head
Marcus Pöhls 2019-12-17 15:29:54 +01:00
parent 3777c92961
commit 1a94c02d06
7 changed files with 100 additions and 9 deletions

15
.eslintrc.json Normal file
View File

@ -0,0 +1,15 @@
{
"env": {
"es6": true,
"node": true
},
"extends": [
"standard"
],
"plugins": [
"standard"
],
"parserOptions": {
"ecmaVersion": 2018
}
}

32
.gitignore vendored Normal file
View File

@ -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

View File

@ -1,4 +0,0 @@
FROM docker:stable
COPY start-redis.sh /start-redis.sh
RUN chmod +x /start-redis.sh
ENTRYPOINT ["/start-redis.sh"]

View File

@ -12,5 +12,5 @@ inputs:
default: 'latest'
runs:
using: 'docker'
image: 'Dockerfile'
using: 'node12'
main: 'start-redis.js'

43
package.json Normal file
View File

@ -0,0 +1,43 @@
{
"name": "@supercharge/redis-github-action",
"description": "Redis server in a GitHub Action",
"version": "1.0.0",
"author": "Marcus Pöhls <marcus@superchargejs.com>",
"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"
}
}

8
start-redis.js Normal file
View File

@ -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()

View File

@ -1,3 +0,0 @@
#!/bin/sh
sh -c "docker run -p 6379:6379 -d redis:$INPUT_REDIS-VERSION"