From bab8890714cb45d7abb340227191a4f42b971bd1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 28 Nov 2024 10:05:44 +0100 Subject: [PATCH 1/4] Bump org.sonarqube from 6.0.0.5145 to 6.0.1.5171 (#1056) Bumps org.sonarqube from 6.0.0.5145 to 6.0.1.5171. --- updated-dependencies: - dependency-name: org.sonarqube dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 3125cfe07e..54c2bf0b95 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ plugins { id "de.undercouch.download" version "5.6.0" // downloads plugin id "kr.motd.sphinx" version "2.10.1" // documentation generation id "com.github.johnrengelman.shadow" version "8.1.1" // fat jar - id "org.sonarqube" version "6.0.0.5145" // sonarqube + id "org.sonarqube" version "6.0.1.5171" // sonarqube id "org.scoverage" version "8.1" // scala code coverage scoverage id "com.github.maiflai.scalatest" version "0.32" // run scalatest without specific spec task id 'org.hidetake.ssh' version '2.11.2' From 3fcc40255f42318ce09260250f031bd08ee2f095 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Tue, 3 Dec 2024 13:07:13 +0100 Subject: [PATCH 2/4] Removed Deployment --- Jenkinsfile | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 84b3073e05..cb5281a764 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -133,52 +133,6 @@ node { } } - // deploy stage only if branch is main or dev - if (env.BRANCH_NAME == "main" || env.BRANCH_NAME == "dev") { - stage('deploy') { - // determine project version - String projectVersion = sh(returnStdout: true, script: "set +x && cd ${projectName}; ./gradlew -q " + - "${(env.BRANCH_NAME == "dev") ? "devVersion" : "currentVersion"}").toString().trim() - - // get the sonatype credentials stored in the jenkins secure keychain - withCredentials([ - usernamePassword(credentialsId: mavenCentralCredentialsId, usernameVariable: 'MAVENCENTRAL_USER', passwordVariable: 'MAVENCENTRAL_PASS'), - file(credentialsId: mavenCentralSignKeyFileId, variable: 'MAVENCENTRAL_KEYFILE'), - usernamePassword(credentialsId: mavenCentralSignKeyId, usernameVariable: 'MAVENCENTRAL_SIGNINGKEYID', passwordVariable: 'MAVENCENTRAL_SIGNINGPASS') - ]) { - - /* - * IMPORTANT: Do not issue 'clean' in the following task - */ - sh( - script: """set +x && cd $projectName""" + - ''' set +x; ./gradlew javadoc''', - returnStdout: true - ) - - String deployGradleTasks = '--refresh-dependencies test ' + - 'publish -Puser=${MAVENCENTRAL_USER} ' + - '-Ppassword=${MAVENCENTRAL_PASS} ' + - '-Psigning.keyId=${MAVENCENTRAL_SIGNINGKEYID} ' + - '-Psigning.password=${MAVENCENTRAL_SIGNINGPASS} ' + - '-Psigning.secretKeyRingFile=${MAVENCENTRAL_KEYFILE} ' + - "-PdeployVersion='$projectVersion'" - - gradle(deployGradleTasks, projectName) - } - - if (env.BRANCH_NAME == "main") { - // create tag on main and push it to origin - createAndPushTagOnMain(projectName, sshCredentialsId) - - // todo JH create github release - - // deploy java docs - deployJavaDocs(projectName, sshCredentialsId, gitCheckoutUrl) - } - } - } - // post processing stage('post processing') { From 40446308288880e8fc853602ce144403c0362bb7 Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Tue, 3 Dec 2024 13:16:18 +0100 Subject: [PATCH 3/4] CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84f8eae170..c5e8f10c65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -108,6 +108,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix implausible test cases of HpModelSpec [#1042](https://github.com/ie3-institute/simona/issues/1042) - Refactoring to only use 'lastHpState' and 'relevantData' for 'ThermalGrid' calculations [#916](https://github.com/ie3-institute/simona/issues/916) - Refactor thermal calcRelevantData [#1051](https://github.com/ie3-institute/simona/issues/1051) +- Removed Deployment stage from Jenkinsfile [#1063](https://github.com/ie3-institute/simona/issues/1063) ### Fixed - Fix rendering of references in documentation [#505](https://github.com/ie3-institute/simona/issues/505) From caeaad0ded03b6d2924e18399e20729079130d9a Mon Sep 17 00:00:00 2001 From: Philipp Schmelter Date: Fri, 6 Dec 2024 16:34:29 +0100 Subject: [PATCH 4/4] Fixing Deployment to Maven-Central in GitHub Actions (#1055) * Pass currentVersion to deployment * Adapted branchName.gradle * Fixed BranchName * Empty Line.. * Added gpg signing * Added some steps to deployment * Changed Signing * Test * Using gpg Agent in build.gradle * debug * Prototype * CHANGELOG.md * added sign * added sign * syn * Debugging Deployment * Debugging Deployment * Debugging Deployment * Debugging Deployment * Debugging Deployment * InMemoryPGP * spotless * changed to ENV variables * Changed property names to ENVs * ORG_GRADLE_PROJECT * debug * spotless * removed KeyID * Prototype * FINAL(LY)! :D * FINAL(LY) for real! :D --- .github/workflows/ci.yml | 21 +++++++++++++++------ CHANGELOG.md | 2 ++ build.gradle | 2 +- gradle/scripts/branchName.gradle | 2 +- gradle/scripts/mavenCentralPublish.gradle | 15 +++++++-------- gradle/scripts/semVer.gradle | 8 ++++---- 6 files changed, 30 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d11126c218..57d023d308 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,12 +78,21 @@ jobs: exit 1 fi + #Deployment - name: Deploy if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' + env: + ORG_GRADLE_PROJECT_signingKey: ${{ secrets.MAVENCENTRAL_SIGNINGKEY }} + ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.MAVENCENTRAL_SIGNINGPASS }} + ORG_GRADLE_PROJECT_user: ${{ secrets.MAVENCENTRAL_USER }} + ORG_GRADLE_PROJECT_password: ${{ secrets.MAVENCENTRAL_PASS }} run: | - ./gradlew publish\ - -Puser=${{ secrets.MAVENCENTRAL_USER }} \ - -Ppassword=${{ secrets.MAVENCENTRAL_PASS }} \ - -Psigning.keyId=${{ secrets.MAVENCENTRAL_SIGNINGKEYID }} \ - -Psigning.password=${{ secrets.MAVENCENTRAL_SIGNINGPASS }} \ - -Psigning.secretKeyRingFile=${{ secrets.MAVENCENTRAL_SIGNINGKEY }} + if [ "${GITHUB_REF}" == "refs/heads/main" ]; then + currentVersion=$(./gradlew -q currentVersion) + else + currentVersion=$(./gradlew -q devVersion) + fi + + echo "currentVersion=$currentVersion" + + ./gradlew publish -PdeployVersion=$currentVersion diff --git a/CHANGELOG.md b/CHANGELOG.md index c5e8f10c65..f8795209c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added weatherData HowTo for Copernicus ERA5 data [#967](https://github.com/ie3-institute/simona/issues/967) - Add some quote to 'printGoodbye' [#997](https://github.com/ie3-institute/simona/issues/997) - Add unapply method for ThermalHouseResults [#934](https://github.com/ie3-institute/simona/issues/934) +- Implemented GitHub Actions Pipeline [#939](https://github.com/ie3-institute/simona/issues/939) - Added `ApparentPower` to differentiate between different power types [#794](https://github.com/ie3-institute/simona/issues/794) - Update/enhance config documentation [#1013](https://github.com/ie3-institute/simona/issues/1013) - Create `CITATION.cff` [#1035](https://github.com/ie3-institute/simona/issues/1035) @@ -149,6 +150,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix initialisation freezing on empty primary data [#981](https://github.com/ie3-institute/simona/issues/981) - Shallow fetch in CI [#1041](https://github.com/ie3-institute/simona/issues/1041) - Correct wrong use of term "wall clock time" [#727](https://github.com/ie3-institute/simona/issues/727) +- Fixed Deployment of `simona` to `Maven Central` in new GHA Pipeline [#1029](https://github.com/ie3-institute/simona/issues/1029) ## [3.0.0] - 2023-08-07 diff --git a/build.gradle b/build.gradle index 54c2bf0b95..bfb0d52427 100644 --- a/build.gradle +++ b/build.gradle @@ -54,7 +54,7 @@ apply from: scriptsLocation + 'scoverage.gradle' // scoverage scala code coverag apply from: scriptsLocation + 'deploy.gradle' apply from: scriptsLocation + 'semVer.gradle' apply from: scriptsLocation + 'mavenCentralPublish.gradle' -apply from: scriptsLocation + 'branchName.gradle' +apply from: scriptsLocation + 'branchName.gradle' // checks naming scheme of branches configurations { scalaCompilerPlugin diff --git a/gradle/scripts/branchName.gradle b/gradle/scripts/branchName.gradle index b1357b16f1..99ba2c5097 100644 --- a/gradle/scripts/branchName.gradle +++ b/gradle/scripts/branchName.gradle @@ -18,7 +18,7 @@ tasks.register('checkBranchName') { def isValid = patterns.any { pattern -> branchName ==~ pattern } if (!isValid) { - throw new GradleException("Error: Check Branch name format (e.g., ps/#1337-FeatureName).") + throw new GradleException("Error: Check Branch name format (e.g., ps/#1337-FeatureName). Current branch name is $branchName.") } println "Branch name is $branchName" diff --git a/gradle/scripts/mavenCentralPublish.gradle b/gradle/scripts/mavenCentralPublish.gradle index c006100df7..9003d01c4c 100644 --- a/gradle/scripts/mavenCentralPublish.gradle +++ b/gradle/scripts/mavenCentralPublish.gradle @@ -10,17 +10,11 @@ task javadocJar(type: Jar, dependsOn: javadoc) { from javadoc.destinationDir } - if (project.hasProperty('user') && project.hasProperty('password') && project.hasProperty('deployVersion')) { // snapshot version differs from normal version String versionString = project.getProperty('deployVersion') - signing { - required { !versionString.endsWith('SNAPSHOT') } - if (required) - sign(publishing.publications) - } publishing { publications { @@ -87,9 +81,15 @@ if (project.hasProperty('user') && project.hasProperty('password') && project.ha } } } + signing { + useInMemoryPgpKeys( + findProperty('signingKey'), + findProperty('signingPassword') + ) + sign publishing.publications.mavenJava + } } - model { tasks.generatePomFileForMavenJavaPublication { destination = file("$buildDir/generated-pom.xml") @@ -98,7 +98,6 @@ if (project.hasProperty('user') && project.hasProperty('password') && project.ha } def removeTestDependenciesFromPom(pom) { - pom.withXml { def root = asNode() // eliminate test-scoped dependencies (no need in maven central POMs) diff --git a/gradle/scripts/semVer.gradle b/gradle/scripts/semVer.gradle index ec680a487b..c330089323 100644 --- a/gradle/scripts/semVer.gradle +++ b/gradle/scripts/semVer.gradle @@ -1,13 +1,13 @@ // tasks for semantic versioning using semver-gradle https://github.com/ethauvin/semver-gradle -task currentVersion { - doFirst{ +tasks.register('currentVersion') { + doFirst { println semver.semver } } -task devVersion { - doFirst{ +tasks.register('devVersion') { + doFirst { println "${semver.major}.${semver.minor}-SNAPSHOT" } }