Skip to content

Commit ed716bc

Browse files
authored
Merge pull request #4 from VirdocsSoftware/jenkins-tagging
Jenkins tagging
2 parents 43be611 + 66bd940 commit ed716bc

File tree

7 files changed

+71
-21
lines changed

7 files changed

+71
-21
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
.idea

.npmignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
node_modules
1+
node_modules
2+
.idea

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
//registry.npmjs.org/:_authToken=${NPM_TOKEN}

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM redshelf/chrome-node:nvm
2+
3+
COPY package.json /srv/app/package.json
4+
5+
WORKDIR /srv/app/
6+
7+
ARG NPM_TOKEN
8+
RUN NPM_TOKEN=$NPM_TOKEN npm i
9+
10+
COPY . /srv/app
11+

Jenkinsfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
stage('publish') {
2+
node('redshelf') {
3+
4+
checkout scm;
5+
6+
env.TAG_NAME = shWithReturn('git describe --exact-match --tags HEAD || :');
7+
8+
if(isTagBuild()) {
9+
env.DOCKER_TAG = dockerTag(env.TAG_NAME.substring(0, env.TAG_NAME.length() - 1));
10+
env.NPM_TAG = 'stable';
11+
} else {
12+
env.DOCKER_TAG = "";
13+
env.NPM_TAG = "";
14+
}
15+
16+
if(env.DOCKER_TAG != "") {
17+
withCredentials([string(credentialsId: 'npm-token', variable: 'NPM_TOKEN')]) {
18+
sh 'sudo -E docker build --build-arg NPM_TOKEN=$NPM_TOKEN-t ${DOCKER_TAG} .';
19+
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}"';
20+
sh "sudo -E docker push ${DOCKER_TAG}";
21+
}
22+
}
23+
}
24+
}
25+
26+
def dockerTag(buildName) {
27+
return "redshelf/git-release-notes:${buildName}";
28+
}
29+
def isTagBuild() {
30+
return env.TAG_NAME && env.TAG_NAME != "";
31+
}
32+
33+
def shWithReturn(script) {
34+
returnVal = sh(returnStdout: true, script: script);
35+
return returnVal;
36+
}

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
{
2-
"author": "ariatemplates <[email protected]> (http://github.com/ariatemplates)",
3-
"name": "git-release-notes",
2+
"author": "redshelf",
3+
"name": "@redshelf/git-release-notes",
44
"description": "Generate beautiful release notes from a git log.",
5-
"keywords": [
6-
"git",
7-
"log",
8-
"release notes",
9-
"compare",
10-
"version"
11-
],
125
"scripts": {
136
"lint": "eslint --fix cli.js index.js lib",
147
"test": "jest",
@@ -19,29 +12,27 @@
1912
"test-script": "node cli.js -s ./samples/post-processing.js 32a369f..0419636 ./templates/markdown.ejs",
2013
"test:watch": "jest --watch"
2114
},
22-
"version": "3.3.1",
15+
"version": "0.0.0",
2316
"dependencies": {
2417
"date-fns": "^1.29.0",
2518
"debug": "^3.1.0",
2619
"ejs": "^2.5.7",
2720
"optimist": "^0.6.1"
2821
},
2922
"contributors": [
30-
{
31-
"name": "Fabio Crisci",
32-
"email": "[email protected]",
33-
"url": "https://github.com/piuccio"
34-
}
23+
"redshelf"
3524
],
36-
"bin": "./cli.js",
25+
"bin": {
26+
"git-release-notes": "./cli.js"
27+
},
3728
"repository": {
3829
"type": "git",
39-
"url": "https://github.com/ariatemplates/git-release-notes"
30+
"url": "git+https://github.com/virdocssoftware/git-release-notes.git"
4031
},
4132
"engines": {
4233
"node": ">=4"
4334
},
44-
"homepage": "https://github.com/ariatemplates/git-release-notes",
35+
"homepage": "https://github.com/virdocssoftware/git-release-notes",
4536
"preferGlobal": true,
4637
"devDependencies": {
4738
"cross-env": "^5.1.3",
@@ -53,5 +44,13 @@
5344
"testMatch": [
5445
"**/*.test.js"
5546
]
56-
}
47+
},
48+
"bugs": {
49+
"url": "https://github.com/virdocssoftware/git-release-notes/issues"
50+
},
51+
"main": "index.js",
52+
"directories": {
53+
"lib": "lib"
54+
},
55+
"license": "ISC"
5756
}

0 commit comments

Comments
 (0)