diff options
| author | Max Nanis | 2025-06-27 13:32:44 +0700 |
|---|---|---|
| committer | Max Nanis | 2025-06-27 13:32:44 +0700 |
| commit | 3faf66e3916f590641fd68f6d041c5885bb27bdf (patch) | |
| tree | bd4c63893b5e1a8a834a374f11456d2ed1bd2f24 /Jenkinsfile | |
| parent | d9c2a565a9b66e8ef12639a5434a2c2262a00b42 (diff) | |
| download | panel-ui-3faf66e3916f590641fd68f6d041c5885bb27bdf.tar.gz panel-ui-3faf66e3916f590641fd68f6d041c5885bb27bdf.zip | |
jenkins, always build but do master, non-master, and tagged deployments
Diffstat (limited to 'Jenkinsfile')
| -rw-r--r-- | Jenkinsfile | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/Jenkinsfile b/Jenkinsfile index b1eeffb..1bbb84d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,11 +15,6 @@ pipeline { } stages { - stage('debug env') { - steps { - sh 'env | sort' - } - } stage('setup'){ steps { @@ -56,10 +51,14 @@ pipeline { stage('npm.build') { when { + /* Only build the widget if we're on master or if it's a tag.. otherwise, we don't + currently have a reason to build dev branch for testing purposes + */ expression { - return env.BRANCH_NAME == 'master' || buildingTag() + return env.BRANCH_NAME == 'master' || env.TAG_NAME?.trim() } } + steps { dir("panel-ui") { sh "/usr/local/bin/npm run build" @@ -78,7 +77,7 @@ pipeline { } } - stage('cdn.deploy') { + stage('cdn.deploy.master') { when { expression { env.BRANCH_NAME == 'master' } } @@ -89,14 +88,35 @@ pipeline { } } - stage('cdn.deploy.tagged-version') { + stage('cdn.deploy.non-master') { when { - buildingTag() + expression { env.BRANCH_NAME != 'master' } } steps { dir("panel-ui") { script { - def tag = env.GIT_TAG_NAME ?: env.GIT_BRANCH.replaceFirst(/^origin\//, '') + def branch = env.BRANCH_NAME + echo "Detected branch: ${branch}" + def versioned = "${env.BUILD_DIR}/${env.JS_FILENAME}-${branch}.js" + sh "cp ${env.BUILD_DIR}/${env.JS_FILENAME}.js ${versioned}" + } + + sh "/usr/bin/rsync -v ${env.BUILD_DIR}/${versioned}.js grl-cdn:/root/gr-cdn/" + } + } + } + + stage('cdn.deploy.tag') { + when { + expression { + return env.TAG_NAME?.trim() + } + } + + steps { + dir("panel-ui") { + script { + def tag = env.TAG_NAME echo "Detected tag: ${tag}" def versioned = "${env.BUILD_DIR}/${env.JS_FILENAME}-${tag}.js" sh "cp ${env.BUILD_DIR}/${env.JS_FILENAME}.js ${versioned}" |
