diff options
| author | Max Nanis | 2025-06-27 11:30:08 +0700 |
|---|---|---|
| committer | Max Nanis | 2025-06-27 11:30:08 +0700 |
| commit | 700c5610d6bcd4f70e3c24526ee217edee2d5fea (patch) | |
| tree | af24571ae4cba37f18f29997cc28e8ca482e862e /Jenkinsfile | |
| parent | 38825f2ebe24fa4fdd08d211bbffff42a433bca3 (diff) | |
| download | panel-ui-700c5610d6bcd4f70e3c24526ee217edee2d5fea.tar.gz panel-ui-700c5610d6bcd4f70e3c24526ee217edee2d5fea.zip | |
cdn.deploy.tagged-version'
Diffstat (limited to 'Jenkinsfile')
| -rw-r--r-- | Jenkinsfile | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/Jenkinsfile b/Jenkinsfile index cbd44dd..1ec0d31 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,6 +1,11 @@ pipeline { agent any + environment { + BUILD_DIR = "dist" + JS_FILENAME = "grl-panel" + } + options { skipDefaultCheckout() } @@ -61,13 +66,32 @@ pipeline { } } - stage('cdn deploy') { + stage('cdn.deploy') { when { expression { env.BRANCH_NAME == 'master' } } steps { dir("panel-ui") { - sh "/usr/bin/rsync -v dist/grl-panel.js grl-cdn:/root/gr-cdn/" + sh "/usr/bin/rsync -v ${env.BUILD_DIR}/${env.JS_FILENAME}.js grl-cdn:/root/gr-cdn/" + } + } + } + + stage('cdn.deploy.tagged-version') { + when { + buildingTag() + } + steps { + dir("panel-ui") { + script { + def tag = env.GIT_TAG_NAME ?: env.GIT_BRANCH.replaceFirst(/^origin\//, '') + echo "Detected tag: ${tag}" + def versioned = "${env.BUILD_DIR}/${env.JS_FILENAME}-${tag}.js" + sh "cp ${env.BUILD_DIR}/${env.JS_FILENAME}.js ${versioned}" + } + + sh "/usr/bin/rsync -v ${env.BUILD_DIR}/${versioned} grl-cdn:/root/gr-cdn/" + } } } |
