2021-07-03 03:01:50 +00:00
|
|
|
pipeline {
|
2021-07-04 01:32:01 +00:00
|
|
|
agent {
|
|
|
|
docker {
|
2021-07-04 01:36:50 +00:00
|
|
|
image 'node:14'
|
2021-07-04 01:32:01 +00:00
|
|
|
}
|
|
|
|
}
|
2021-07-03 03:01:50 +00:00
|
|
|
|
|
|
|
environment {
|
2021-07-05 15:01:44 +00:00
|
|
|
GITEA_URL = 'https://code.relms.dev/NeonJS/library'
|
2021-07-03 03:01:50 +00:00
|
|
|
GITEA_TOKEN = credentials('GITEA_TOKEN')
|
|
|
|
NPM_TOKEN = credentials('NPM_TOKEN')
|
|
|
|
GIT_AUTHOR_NAME = 'JenkinsCI'
|
|
|
|
GIT_AUTHOR_EMAIL = 'jenkins@relms.dev'
|
2021-07-03 03:08:52 +00:00
|
|
|
GIT_COMMITTER_NAME = 'JenkinsCI'
|
2021-07-03 03:01:50 +00:00
|
|
|
GIT_COMMITTER_EMAIL = 'jenkins@relms.dev'
|
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
2021-07-05 15:01:44 +00:00
|
|
|
stage('Checkout') {
|
|
|
|
steps {
|
|
|
|
scmSkip(deleteBuild: true, skipPattern:'.*\\[ci skip\\].*')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-04 01:32:01 +00:00
|
|
|
stage('Dependencies') {
|
2021-07-03 03:01:50 +00:00
|
|
|
steps {
|
2021-07-04 01:32:01 +00:00
|
|
|
echo '==========Installing Dependencies=========='
|
|
|
|
sh 'yarn install'
|
2021-07-03 03:01:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-04 01:32:01 +00:00
|
|
|
stage('Build') {
|
2021-07-03 03:01:50 +00:00
|
|
|
steps {
|
2021-07-04 01:32:01 +00:00
|
|
|
echo '==========Bundling Application=========='
|
|
|
|
sh 'yarn build'
|
2021-07-03 03:01:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-04 01:32:01 +00:00
|
|
|
stage('Publish') {
|
2021-07-03 03:01:50 +00:00
|
|
|
steps {
|
2021-07-04 01:36:50 +00:00
|
|
|
script {
|
|
|
|
echo '==========Publishing to NPM=========='
|
|
|
|
if(env.BRANCH_NAME == 'master') {
|
|
|
|
echo '==========Publishing as Development Version=========='
|
|
|
|
sh 'echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc'
|
|
|
|
sh 'yarn version $(node -pe \'require("./package.json").version\')-$(git rev-parse HEAD).$(date +%s)'
|
|
|
|
sh 'npm publish --tag dev --access public'
|
|
|
|
} else if(env.BRANCH_NAME == 'stable') {
|
|
|
|
echo '==========Publishing as Stable Version=========='
|
|
|
|
sh 'semantic-release'
|
|
|
|
}
|
2021-07-04 01:32:01 +00:00
|
|
|
}
|
2021-07-03 03:01:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|