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

48 lines
1 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 {
image 'node:14-alpine'
}
}
2021-07-03 03:01:50 +00:00
environment {
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'
2021-07-04 01:32:01 +00:00
NODE_ENV = 'production'
2021-07-03 03:01:50 +00:00
}
stages {
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:32:01 +00:00
echo '==========Publishing to NPM=========='
if(env.BRANCH_NAME == 'master') {
echo '==========Publishing as Development Version=========='
sh 'yarn version $(jq --raw-output ".version" package.json)-$(git rev-parse --short HEAD).$(date +%s)'
sh 'yarn npm publish --tag dev'
} else if(env.BRANCH_NAME == 'stable') {
echo '==========Publishing as Stable Version=========='
sh 'semantic-release'
}
2021-07-03 03:01:50 +00:00
}
}
}
}