diff --git a/.github/workflows/full-build-ci.yml b/.github/workflows/full-build-ci.yml index 54a6d1cbb7d..a8f2640b7a3 100644 --- a/.github/workflows/full-build-ci.yml +++ b/.github/workflows/full-build-ci.yml @@ -205,6 +205,14 @@ jobs: secrets: DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + publish-nexus-snapshots: + needs: build-core + uses: $/.github/workflows/publish-nexus-snapshots.yml + secrets: + DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + NEXUS_USER: ${{ secrets.NEXUS_USER }} + NEXUS_PW: ${{ secrets.NEXUS_PW }} + publish-dockerhub: needs: build-core uses: ./.github/workflows/publish-dockerhub.yml diff --git a/.github/workflows/publish-nexus-snapshots.yml b/.github/workflows/publish-nexus-snapshots.yml new file mode 100644 index 00000000000..2a49d155048 --- /dev/null +++ b/.github/workflows/publish-nexus-snapshots.yml @@ -0,0 +1,98 @@ +name: Fineract Publish Client and Avro Snapshots to Apache Nexus +on: + workflow_dispatch: + workflow_call: + secrets: + DEVELOCITY_ACCESS_KEY: + required: false + NEXUS_USER: + required: false + NEXUS_PW: + required: false +permissions: + contents: read +jobs: + publish: + # Snapshots only, and only from develop. Releases are staged and promoted through a PMC vote, + # so they are never pushed from CI. + if: ${{ github.event_name == 'push' && github.ref_name == 'develop' }} + runs-on: ubuntu-24.04 + timeout-minutes: 90 + env: + DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} + steps: + - name: Set up JDK 25 + uses: actions/setup-java@dd06d9cba3e5552c54d9f8ea23572deb30010f7c # v6.0.0 + with: + java-version: '25' + distribution: 'zulu' + + - name: Download workspace + id: download-workspace + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 + continue-on-error: true + with: + name: fineract-workspace-${{ github.run_id }} + path: . + + - name: Extract workspace + if: steps.download-workspace.outcome == 'success' + run: tar -xf fineract-workspace.tar + + - name: Checkout + if: steps.download-workspace.outcome != 'success' + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + fetch-depth: 0 + fetch-tags: true + + - name: Build workspace fallback + if: steps.download-workspace.outcome != 'success' + uses: $/.github/actions/setup-and-build-fineract + with: + cache-read-only: false + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0 + + - name: Apply Gradle memory budget + uses: $/.github/actions/gradle-memory-budget + with: + max-heap: '4g' + workers-max: '2' + + # ASF Nexus credentials are provisioned by INFRA and are not available on forks or to + # pull requests. Without them the publish would fail with a 401, so skip instead. + - name: Check for Nexus credentials + id: creds + env: + NEXUS_USER: ${{ secrets.NEXUS_USER }} + run: | + if [ -z "$NEXUS_USER" ]; then + echo "available=false" >> "$GITHUB_OUTPUT" + echo "::notice::NEXUS_USER is not set — skipping the snapshot publish." + else + echo "available=true" >> "$GITHUB_OUTPUT" + fi + + # Only the three consumer-facing artifacts are published. Everything else in + # fineractPublishProjects stays buildable but is not pushed to Nexus. + # + # '-x buildJavaSdk' is required: the OpenAPI generator needs an 8g heap, and this job runs + # under the 4g budget above. The generated sources arrive already built in the workspace + # artifact (see .github/scripts/gradle-memory-budget.sh). + - name: Publish snapshots to Apache Nexus + if: steps.creds.outputs.available == 'true' + env: + NEXUS_USER: ${{ secrets.NEXUS_USER }} + NEXUS_PW: ${{ secrets.NEXUS_PW }} + run: | + ./gradlew --no-daemon --console=plain \ + :fineract-avro-schemas:publishMavenJavaPublicationToApacheRepository \ + :fineract-client:publishMavenJavaPublicationToApacheRepository \ + :fineract-client-feign:publishMavenJavaPublicationToApacheRepository \ + -PnoSign=true \ + -Pfineract.config.username="$NEXUS_USER" \ + -Pfineract.config.password="$NEXUS_PW" \ + -x buildJavaSdk diff --git a/build.gradle b/build.gradle index 351ecfaad57..661af3060c6 100644 --- a/build.gradle +++ b/build.gradle @@ -62,29 +62,7 @@ buildscript { [ 'fineract-avro-schemas', 'fineract-client', - 'fineract-client-feign', - 'fineract-core', - 'fineract-security', - 'fineract-cob', - 'fineract-validation', - 'fineract-command', - 'fineract-command-jdbc', - 'fineract-command-audit', - 'fineract-accounting', - 'fineract-provider', - 'fineract-investor', - 'fineract-charge', - 'fineract-rates', - 'fineract-tax', - 'fineract-loan-origination', - 'fineract-loan', - 'fineract-savings', - 'fineract-report', - 'fineract-branch', - 'fineract-document', - 'fineract-progressive-loan', - 'fineract-progressive-loan-embeddable-schedule-generator', - 'fineract-working-capital-loan' + 'fineract-client-feign' ].contains(it.name) } npmRepository = 'https://npm.pkg.github.com' @@ -171,7 +149,7 @@ gitVersioning.apply { } } rev { - version = '${describe.tag.version.major}.${describe.tag.version.minor.next}.0-SNAPSHOT' + version = '${describe.tag.version.major}.${describe.tag.version.minor.next}.0-${commit.short}-SNAPSHOT' } } @@ -908,7 +886,7 @@ configure(project.fineractPublishProjects) { mavenJava(MavenPublication) { groupId = 'org.apache.fineract' artifactId = project.name - version = "${project.version}-SNAPSHOT" + version = "${project.version}" from components.java