diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..eb79dd5 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +node_modules +.idea diff --git a/.npmignore b/.npmignore index b512c09..eb79dd5 100644 --- a/.npmignore +++ b/.npmignore @@ -1 +1,2 @@ -node_modules \ No newline at end of file +node_modules +.idea diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..ae64359 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +//registry.npmjs.org/:_authToken=${NPM_TOKEN} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9c82bae --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM redshelf/chrome-node:nvm + +COPY package.json /srv/app/package.json + +WORKDIR /srv/app/ + +ARG NPM_TOKEN +RUN NPM_TOKEN=$NPM_TOKEN npm i + +COPY . /srv/app + diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..325ee52 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,36 @@ +stage('publish') { + node('redshelf') { + + checkout scm; + + env.TAG_NAME = shWithReturn('git describe --exact-match --tags HEAD || :'); + + if(isTagBuild()) { + env.DOCKER_TAG = dockerTag(env.TAG_NAME.substring(0, env.TAG_NAME.length() - 1)); + env.NPM_TAG = 'stable'; + } else { + env.DOCKER_TAG = ""; + env.NPM_TAG = ""; + } + + if(env.DOCKER_TAG != "") { + withCredentials([string(credentialsId: 'npm-token', variable: 'NPM_TOKEN')]) { + sh 'sudo -E docker build --build-arg NPM_TOKEN=$NPM_TOKEN-t ${DOCKER_TAG} .'; + sh 'sudo -E docker run -e "NPM_TOKEN=$NPM_TOKEN" ${DOCKER_TAG} bash -c "npm --no-git-tag-version version ${DOCKER_TAG} && npm publish --tag ${NPM_TAG}"'; + sh "sudo -E docker push ${DOCKER_TAG}"; + } + } + } +} + +def dockerTag(buildName) { + return "redshelf/git-release-notes:${buildName}"; +} +def isTagBuild() { + return env.TAG_NAME && env.TAG_NAME != ""; +} + +def shWithReturn(script) { + returnVal = sh(returnStdout: true, script: script); + return returnVal; +} diff --git a/package-lock.json b/package-lock.json index fcdeae9..bf824ee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "git-release-notes", - "version": "3.0.0", + "version": "0.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index d263401..61bfa35 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,7 @@ { - "author": "ariatemplates (http://github.com/ariatemplates)", - "name": "git-release-notes", + "author": "redshelf", + "name": "@redshelf/git-release-notes", "description": "Generate beautiful release notes from a git log.", - "keywords": [ - "git", - "log", - "release notes", - "compare", - "version" - ], "scripts": { "lint": "eslint --fix cli.js index.js lib", "test": "jest", @@ -19,7 +12,7 @@ "test-script": "node cli.js -s ./samples/post-processing.js 32a369f..0419636 ./templates/markdown.ejs", "test:watch": "jest --watch" }, - "version": "3.3.1", + "version": "0.0.0", "dependencies": { "date-fns": "^1.29.0", "debug": "^3.1.0", @@ -27,21 +20,19 @@ "optimist": "^0.6.1" }, "contributors": [ - { - "name": "Fabio Crisci", - "email": "fabio@ariatemplates.com", - "url": "https://github.com/piuccio" - } + "redshelf" ], - "bin": "./cli.js", + "bin": { + "git-release-notes": "./cli.js" + }, "repository": { "type": "git", - "url": "https://github.com/ariatemplates/git-release-notes" + "url": "git+https://github.com/virdocssoftware/git-release-notes.git" }, "engines": { "node": ">=4" }, - "homepage": "https://github.com/ariatemplates/git-release-notes", + "homepage": "https://github.com/virdocssoftware/git-release-notes", "preferGlobal": true, "devDependencies": { "cross-env": "^5.1.3", @@ -53,5 +44,13 @@ "testMatch": [ "**/*.test.js" ] - } + }, + "bugs": { + "url": "https://github.com/virdocssoftware/git-release-notes/issues" + }, + "main": "index.js", + "directories": { + "lib": "lib" + }, + "license": "ISC" }