From 46d4e11b40ecc7f1d674e0301111afa724fa2d93 Mon Sep 17 00:00:00 2001 From: EdwinBetanc0urt Date: Sun, 8 Dec 2024 22:06:18 -0400 Subject: [PATCH 1/8] fix: Version published on release. --- .github/workflows/publish.yml | 5 +++++ src/main/java/org/spin/base/Version.java | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 40fd1fe..bdfb044 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -41,6 +41,11 @@ jobs: - name: Set Main Version run: echo "MAIN_VERSION=${{ github.event.release.name }}" >> src/main/java/org/spin/base/version.properties + - name: Test version + run: | + run ${{ github.event.release.name }} + cat src/main/java/org/spin/base/version.properties + - name: Set Release Date run: echo "DATE_VERSION=$(date +'%Y-%m-%d')" >> src/main/java/org/spin/base/version.properties diff --git a/src/main/java/org/spin/base/Version.java b/src/main/java/org/spin/base/Version.java index 8aafde0..6b65146 100644 --- a/src/main/java/org/spin/base/Version.java +++ b/src/main/java/org/spin/base/Version.java @@ -21,6 +21,8 @@ import java.text.SimpleDateFormat; import java.util.Properties; +import org.compiere.util.CLogger; + /** * @author Edwin Betancourt, EdwinBetanc0urt@outlook.com, https://github.com/EdwinBetanc0urt * Service for backend of Version @@ -28,6 +30,8 @@ public final class Version { + private static CLogger log = CLogger.getCLogger(Version.class); + /** Main Version String */ // Conventions for naming second number is even for stable, and odd for unstable // the releases will have a suffix (a) for alpha - (b) for beta - (t) for trunk - (s) for stable - and (LTS) for long term support @@ -60,7 +64,8 @@ public final class Version IMPLEMENTATION_VERSION = properties.getProperty("IMPLEMENTATION_VERSION"); } } catch (IOException e) { - // file does not exist + // file does not exists + log.warning("File version.properties does no exists"); } } } From 6949f144703952eb54772caa2b4d776991f35e73 Mon Sep 17 00:00:00 2001 From: EdwinBetanc0urt Date: Sun, 8 Dec 2024 22:15:41 -0400 Subject: [PATCH 2/8] fix run command. --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index bdfb044..c346ca5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -43,7 +43,7 @@ jobs: - name: Test version run: | - run ${{ github.event.release.name }} + echo ${{ github.event.release.name }} cat src/main/java/org/spin/base/version.properties - name: Set Release Date From 4db1dfad596202b85e4c6d240f63a0ece8ac8b4d Mon Sep 17 00:00:00 2001 From: EdwinBetanc0urt Date: Sun, 8 Dec 2024 23:25:20 -0400 Subject: [PATCH 3/8] add interceptor. --- .github/workflows/publish.yml | 10 +++++----- .../spin/report_engine/server/ReportEngineServer.java | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c346ca5..908ef2a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -41,17 +41,17 @@ jobs: - name: Set Main Version run: echo "MAIN_VERSION=${{ github.event.release.name }}" >> src/main/java/org/spin/base/version.properties - - name: Test version - run: | - echo ${{ github.event.release.name }} - cat src/main/java/org/spin/base/version.properties - - name: Set Release Date run: echo "DATE_VERSION=$(date +'%Y-%m-%d')" >> src/main/java/org/spin/base/version.properties - name: Set Implementation Version run: echo "IMPLEMENTATION_VERSION=${{ github.event.release.tag_name }}" >> src/main/java/org/spin/base/version.properties + - name: Test version + run: | + echo ${{ github.event.release.name }} + cat src/main/java/org/spin/base/version.properties + - name: Upload descriptor file artifact uses: actions/upload-artifact@v4 with: diff --git a/src/main/java/org/spin/report_engine/server/ReportEngineServer.java b/src/main/java/org/spin/report_engine/server/ReportEngineServer.java index 5e823c2..931ba99 100644 --- a/src/main/java/org/spin/report_engine/server/ReportEngineServer.java +++ b/src/main/java/org/spin/report_engine/server/ReportEngineServer.java @@ -44,6 +44,7 @@ public class ReportEngineServer { /** Services/Methods allow request without Bearer token validation */ private List ALLOW_REQUESTS_WITHOUT_TOKEN = Arrays.asList( // proto package . proto service / proto method + "report_engine.ReportEngine/GetSystemInfo" ); /** Revoke session */ From 4bce80a2cd03af608107b8e58f97c0f30ac502ee Mon Sep 17 00:00:00 2001 From: EdwinBetanc0urt Date: Sun, 8 Dec 2024 23:36:49 -0400 Subject: [PATCH 4/8] fix version file before create release. --- .github/workflows/publish.yml | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 908ef2a..ffc36a4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -28,16 +28,6 @@ jobs: java-version: 11 architecture: x64 - - name: Build with Gradle - uses: gradle/gradle-build-action@v3 - with: - gradle-version: 8.0.2 - arguments: createRelease - env: - GITHUB_DEPLOY_USER: ${{ secrets.DEPLOY_USER }} - GITHUB_DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }} - GITHUB_DEPLOY_REPOSITORY: ${{ secrets.DEPLOY_REPOSITORY }} - - name: Set Main Version run: echo "MAIN_VERSION=${{ github.event.release.name }}" >> src/main/java/org/spin/base/version.properties @@ -47,10 +37,15 @@ jobs: - name: Set Implementation Version run: echo "IMPLEMENTATION_VERSION=${{ github.event.release.tag_name }}" >> src/main/java/org/spin/base/version.properties - - name: Test version - run: | - echo ${{ github.event.release.name }} - cat src/main/java/org/spin/base/version.properties + - name: Build with Gradle + uses: gradle/gradle-build-action@v3 + with: + gradle-version: 8.0.2 + arguments: createRelease + env: + GITHUB_DEPLOY_USER: ${{ secrets.DEPLOY_USER }} + GITHUB_DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }} + GITHUB_DEPLOY_REPOSITORY: ${{ secrets.DEPLOY_REPOSITORY }} - name: Upload descriptor file artifact uses: actions/upload-artifact@v4 From 0b474c591b0724782a9064a04edc9a98d123c3e9 Mon Sep 17 00:00:00 2001 From: EdwinBetanc0urt Date: Sun, 8 Dec 2024 23:59:14 -0400 Subject: [PATCH 5/8] include version folder. --- build.gradle | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index 8773b46..09676d5 100644 --- a/build.gradle +++ b/build.gradle @@ -84,16 +84,17 @@ protobuf { } sourceSets { - main { - java { - srcDirs 'build/generated/source/proto/main/grpc' - srcDirs 'build/generated/source/proto/main/java' - srcDirs 'src/main/proto' - } + main { + java { + srcDirs 'build/generated/source/proto/main/grpc' + srcDirs 'build/generated/source/proto/main/java' + srcDirs 'src/main/proto' + } resources { + srcDirs 'src/main/java' include 'org/spin/base/version.properties' } - } + } } // Copy proto descriptor another folder @@ -111,16 +112,16 @@ allprojects { } } -task AdempiereTemplateServer(type: CreateStartScripts) { +task AdempiereReportEngineServer(type: CreateStartScripts) { mainClass = javaMainClass - applicationName = 'adempiere-report-engine-service-server' - outputDir = new File(project.buildDir, 'tmp') - classpath = jar.outputs.files + project.configurations.runtimeClasspath + applicationName = 'adempiere-report-engine-service-server' + outputDir = new File(project.buildDir, 'tmp') + classpath = jar.outputs.files + project.configurations.runtimeClasspath } applicationDistribution.into('bin') { - from(AdempiereTemplateServer) - fileMode = 0755 + from(AdempiereReportEngineServer) + fileMode = 0755 } // Create release for project From 122e41f20b4c676cffddfb707c0d82bff92bb147 Mon Sep 17 00:00:00 2001 From: EdwinBetanc0urt Date: Mon, 9 Dec 2024 09:58:22 -0400 Subject: [PATCH 6/8] fix: CI with public packages. --- .github/workflows/ci.yml | 4 ++-- .github/workflows/publish.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf2260e..65cdb25 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,8 +49,8 @@ jobs: - name: Build with Gradle uses: gradle/gradle-build-action@v2 env: - GITHUB_DEPLOY_USER: "${{ secrets.DEPLOY_USER }}" - GITHUB_DEPLOY_TOKEN: "${{ secrets.DEPLOY_TOKEN }}" + GITHUB_DEPLOY_USER: "${{ github.actor }}" + GITHUB_DEPLOY_TOKEN: "${{ secrets.GITHUB_TOKEN }}" GITHUB_DEPLOY_REPOSITORY: ${{ secrets.DEPLOY_REPOSITORY }} with: gradle-version: 8.0.2 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 40fd1fe..52ebda7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -34,8 +34,8 @@ jobs: gradle-version: 8.0.2 arguments: createRelease env: - GITHUB_DEPLOY_USER: ${{ secrets.DEPLOY_USER }} - GITHUB_DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }} + GITHUB_DEPLOY_USER: ${{ github.actor }} + GITHUB_DEPLOY_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_DEPLOY_REPOSITORY: ${{ secrets.DEPLOY_REPOSITORY }} - name: Set Main Version From d9480ccd824b15f2bf01dd0b556998924914a2f8 Mon Sep 17 00:00:00 2001 From: EdwinBetanc0urt Date: Mon, 9 Dec 2024 10:24:12 -0400 Subject: [PATCH 7/8] add env with custom properties --- .github/workflows/ci.yml | 7 +++++-- .github/workflows/publish.yml | 3 +++ .gitignore | 6 +++++- build.gradle | 7 ++++--- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 65cdb25..2472c0e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,9 +49,12 @@ jobs: - name: Build with Gradle uses: gradle/gradle-build-action@v2 env: - GITHUB_DEPLOY_USER: "${{ github.actor }}" - GITHUB_DEPLOY_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + GITHUB_DEPLOY_USER: ${{ github.actor }} + GITHUB_DEPLOY_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_DEPLOY_REPOSITORY: ${{ secrets.DEPLOY_REPOSITORY }} + ORG_GRADLE_PROJECT_deployUsername: ${{ secrets.DEPLOY_USER }} + ORG_GRADLE_PROJECT_deployToken: ${{ secrets.DEPLOY_TOKEN }} + ORG_GRADLE_PROJECT_deplyRepository: ${{ secrets.DEPLOY_REPOSITORY }} with: gradle-version: 8.0.2 arguments: build diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 52ebda7..b767252 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -37,6 +37,9 @@ jobs: GITHUB_DEPLOY_USER: ${{ github.actor }} GITHUB_DEPLOY_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_DEPLOY_REPOSITORY: ${{ secrets.DEPLOY_REPOSITORY }} + ORG_GRADLE_PROJECT_deployUsername: ${{ secrets.DEPLOY_USER }} + ORG_GRADLE_PROJECT_deployToken: ${{ secrets.DEPLOY_TOKEN }} + ORG_GRADLE_PROJECT_deplyRepository: ${{ secrets.DEPLOY_REPOSITORY }} - name: Set Main Version run: echo "MAIN_VERSION=${{ github.event.release.name }}" >> src/main/java/org/spin/base/version.properties diff --git a/.gitignore b/.gitignore index a9e8fe5..f113d09 100644 --- a/.gitignore +++ b/.gitignore @@ -23,5 +23,9 @@ hs_err_pid* /bin/ /.gradle/ +/libs/ +/dependences/ /build/ -*.properties \ No newline at end of file +*.properties +# skip folder dependencies +!dependencies/*.jar diff --git a/build.gradle b/build.gradle index 8773b46..1b53f83 100644 --- a/build.gradle +++ b/build.gradle @@ -5,6 +5,7 @@ plugins { id 'application' id 'visual-studio' id 'maven-publish' + id "co.uzzu.dotenv.gradle" version "4.0.0" } group 'com.nikhilm' @@ -42,9 +43,9 @@ repositories { // Adempiere GitHub Organization url = 'https://maven.pkg.github.com/adempiere/adempiere' credentials { - // project property, system properrty, enviroment variable - username = findProperty("deployUsername") ?: System.properties['deploy.user'] ?: System.getenv("GITHUB_DEPLOY_USER") - password = findProperty("deployToken") ?: System.properties['deploy.token'] ?: System.getenv("GITHUB_DEPLOY_TOKEN") + // project property, system properrty, .env file, enviroment variable system + username = findProperty("deployUsername") ?: System.properties['deploy.user'] ?: env.GITHUB_DEPLOY_TOKEN.value ?: System.getenv("GITHUB_DEPLOY_USER") + password = findProperty("deployToken") ?: System.properties['deploy.token'] ?: env.GITHUB_DEPLOY_TOKEN.value ?: System.getenv("GITHUB_DEPLOY_TOKEN") } } } From c786b55b8c7e6b190b5601617504065fbee671c5 Mon Sep 17 00:00:00 2001 From: EdwinBetanc0urt Date: Mon, 9 Dec 2024 10:35:20 -0400 Subject: [PATCH 8/8] revert .env file changes. --- build.gradle | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 1b53f83..8773b46 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,6 @@ plugins { id 'application' id 'visual-studio' id 'maven-publish' - id "co.uzzu.dotenv.gradle" version "4.0.0" } group 'com.nikhilm' @@ -43,9 +42,9 @@ repositories { // Adempiere GitHub Organization url = 'https://maven.pkg.github.com/adempiere/adempiere' credentials { - // project property, system properrty, .env file, enviroment variable system - username = findProperty("deployUsername") ?: System.properties['deploy.user'] ?: env.GITHUB_DEPLOY_TOKEN.value ?: System.getenv("GITHUB_DEPLOY_USER") - password = findProperty("deployToken") ?: System.properties['deploy.token'] ?: env.GITHUB_DEPLOY_TOKEN.value ?: System.getenv("GITHUB_DEPLOY_TOKEN") + // project property, system properrty, enviroment variable + username = findProperty("deployUsername") ?: System.properties['deploy.user'] ?: System.getenv("GITHUB_DEPLOY_USER") + password = findProperty("deployToken") ?: System.properties['deploy.token'] ?: System.getenv("GITHUB_DEPLOY_TOKEN") } } }