You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by ti...@apache.org on 2024/05/15 15:27:33 UTC
(incubator-kie-tools) branch main updated: NO-ISSUE: Update weekly job to use version defined on package.json file (#2323)
This is an automated email from the ASF dual-hosted git repository.
tiagobento pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-tools.git
The following commit(s) were added to refs/heads/main by this push:
new cd8d9d68189 NO-ISSUE: Update weekly job to use version defined on package.json file (#2323)
cd8d9d68189 is described below
commit cd8d9d681890aa9444631c3eb73b45f21044490a
Author: Rodrigo Antunes <co...@rodrigoantunes.com.br>
AuthorDate: Wed May 15 12:27:28 2024 -0300
NO-ISSUE: Update weekly job to use version defined on package.json file (#2323)
---
.ci/jenkins/Jenkinsfile.weekly-publish | 30 +++++++++++++++++++++++++++---
1 file changed, 27 insertions(+), 3 deletions(-)
diff --git a/.ci/jenkins/Jenkinsfile.weekly-publish b/.ci/jenkins/Jenkinsfile.weekly-publish
index 1b1125a2c6f..2111fcf7dd3 100644
--- a/.ci/jenkins/Jenkinsfile.weekly-publish
+++ b/.ci/jenkins/Jenkinsfile.weekly-publish
@@ -17,7 +17,7 @@
import java.text.SimpleDateFormat
-def sdf = new SimpleDateFormat("yyyy-MM-dd")
+def sdf = new SimpleDateFormat('yyyy-MM-dd')
def dateDefaultValue = sdf.format(new Date())
@Library('jenkins-pipeline-shared-libraries')_
@@ -81,6 +81,16 @@ pipeline {
}
}
+ stage('Setup package version') {
+ steps {
+ dir('kie-tools') {
+ script {
+ env.PACKAGE_VERSION = sh(returnStdout: true, script: "#!/bin/bash -el \n node -p \"require('./package.json').version\"").trim()
+ }
+ }
+ }
+ }
+
stage('Setup PNPM') {
steps {
dir('kie-tools') {
@@ -107,7 +117,7 @@ pipeline {
script {
withCredentials([usernamePassword(credentialsId: "${pipelineVars.mavenDeployRepositoryCredentialsId}", usernameVariable: 'REPOSITORY_USER', passwordVariable: 'REPOSITORY_TOKEN')]) {
configFileProvider([configFile(fileId: "${pipelineVars.mavenSettingsConfigFileId}", variable: 'MAVEN_SETTINGS_FILE')]) {
- timestampedSnapshotVersion = "999.0.0-${getDateFromCheckoutDateTime()}-SNAPSHOT"
+ timestampedSnapshotVersion = getTimestampedSnapshotVersion()
sh """#!/bin/bash -el
pnpm update-version-to ${timestampedSnapshotVersion} ${env.PNPM_FILTER_STRING}
pnpm ${env.PNPM_FILTER_STRING} exec 'bash' '-c' 'echo -e "\n--settings=${MAVEN_SETTINGS_FILE}" >> .mvn/maven.config'
@@ -126,7 +136,7 @@ pipeline {
steps {
dir('kie-tools') {
script {
- tagName = "999-${getDateFromCheckoutDateTime()}"
+ tagName = getTagName()
githubUtils.createTag("${tagName}")
githubUtils.pushObject('origin', "${tagName}", "${pipelineVars.asfGithubPushCredentialsId}")
}
@@ -147,3 +157,17 @@ String getDateFromCheckoutDateTime() {
def parsedDate = (params.GIT_CHECKOUT_DATETIME =~ /(\d{4}-\d{2}-\d{2})/)[0][0]
return parsedDate.replace('-', '')
}
+
+String getTagName() {
+ if (env.PACKAGE_VERSION == '0.0.0') {
+ return "999-${getDateFromCheckoutDateTime()}"
+ }
+ return "${env.PACKAGE_VERSION}-${getDateFromCheckoutDateTime()}"
+}
+
+String getTimestampedSnapshotVersion() {
+ if (env.PACKAGE_VERSION == '0.0.0') {
+ return "999.0.0-${getDateFromCheckoutDateTime()}-SNAPSHOT"
+ }
+ return "${env.PACKAGE_VERSION}-${getDateFromCheckoutDateTime()}-SNAPSHOT"
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org