Archived
0
0
Fork 0
This repository has been archived on 2024-02-06. You can view files and clone it, but cannot push or open issues or pull requests.
library/Jenkinsfile

95 lines
2.5 KiB
Text
Raw Normal View History

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
}
}
}
2021-07-06 17:44:55 +00:00
post {
always {
deleteDir()
cleanWs()
}
success {
discordSend
description: 'CI build was a Success',
link: env.BUILD_URL,
result: 'SUCCESS',
title: env.JOB_NAME,
webhookURL: 'https://canary.discord.com/api/webhooks/862023194369327124/EZK-yFfzoVIEr5Qjwvb14XLkF1-rtBep7Rkdl4a3aLfSPTvVRAuUGchjDsj2jPPRt3HU'
}
unstable {
discordSend
description: 'CI build was Unstable.',
link: env.BUILD_URL,
result: 'UNSTABLE',
title: env.JOB_NAME,
webhookURL: 'https://canary.discord.com/api/webhooks/862023194369327124/EZK-yFfzoVIEr5Qjwvb14XLkF1-rtBep7Rkdl4a3aLfSPTvVRAuUGchjDsj2jPPRt3HU'
}
failure {
discordSend
description: 'CI build has Failed.',
link: env.BUILD_URL,
result: 'FAILURE',
title: env.JOB_NAME,
webhookURL: 'https://canary.discord.com/api/webhooks/862023194369327124/EZK-yFfzoVIEr5Qjwvb14XLkF1-rtBep7Rkdl4a3aLfSPTvVRAuUGchjDsj2jPPRt3HU'
}
aborted {
discordSend
description: 'CI build was Aborted',
link: env.BUILD_URL,
result: 'ABORTED',
title: env.JOB_NAME,
webhookURL: 'https://canary.discord.com/api/webhooks/862023194369327124/EZK-yFfzoVIEr5Qjwvb14XLkF1-rtBep7Rkdl4a3aLfSPTvVRAuUGchjDsj2jPPRt3HU'
}
}
2021-07-03 03:01:50 +00:00
}