Skip to content

Commit 0dde318

Browse files
Add Jenkinsfile
1 parent e6aa5af commit 0dde318

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

Jenkinsfile

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
pipeline {
2+
agent any
3+
environment {
4+
FORCE_COLOR = 1
5+
}
6+
options {
7+
ansiColor('xterm')
8+
}
9+
stages {
10+
11+
stage('Checkout') {
12+
steps {
13+
script {
14+
gitCheckout([ githubProjectName: 'typescript-docs-verifier' ])
15+
}
16+
}
17+
}
18+
19+
stage('Build and Test') {
20+
steps {
21+
sh '''
22+
yarn install
23+
yarn test
24+
node_modules/.bin/nsp check --output standard
25+
'''
26+
}
27+
}
28+
29+
stage('Publishing compiled javascript') {
30+
steps {
31+
sh '''
32+
sed -i /^dist$/d .gitignore
33+
git add dist
34+
git commit --allow-empty -m "Automated CI commit of compiled javascript"
35+
git push origin HEAD:master
36+
'''
37+
}
38+
}
39+
40+
stage('Release') {
41+
steps {
42+
script {
43+
def version = sh(script: '''node -e "console.log(require('./package.json').version)"''', returnStdout: true).trim()
44+
def tagExists = sh(script: "git ls-remote --tags -q [email protected]:bbc/typescript-docs-verifier.git $version", returnStdout: true).trim()
45+
46+
if (tagExists) {
47+
echo "Release $version already exists -- skipping tagging of release"
48+
} else {
49+
tagRelease([ release: version, releaseTitle: 'Release' ])
50+
}
51+
}
52+
}
53+
}
54+
}
55+
56+
post {
57+
always {
58+
junit allowEmptyResults: true, testResults: 'test-reports/unittest/*.xml'
59+
publishHTML([allowMissing: true, alwaysLinkToLastBuild: true, keepAll: false, reportDir: 'test-reports/coverage', reportFiles: 'index.html', reportName: 'Coverage Report', reportTitles: ''])
60+
}
61+
}
62+
}

0 commit comments

Comments
 (0)