| name: Fineract Publish to DockerHub |
| on: |
| workflow_call: |
| permissions: |
| contents: read |
| jobs: |
| build: |
| if: ${{ github.event_name == 'push' && (github.ref_name == 'develop' || startsWith(github.ref_name, '1.')) }} |
| runs-on: ubuntu-24.04 |
| timeout-minutes: 60 |
| env: |
| DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }} |
| steps: |
| - name: Set up JDK 21 |
| uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5 |
| with: |
| java-version: '21' |
| distribution: 'zulu' |
| |
| - name: Download workspace |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 |
| with: |
| name: fineract-workspace-${{ github.run_id }} |
| path: . |
| |
| - name: Extract workspace |
| run: tar -xf fineract-workspace.tar |
| |
| - name: Setup Gradle |
| uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2 |
| |
| - name: Get Git Hashes |
| run: | |
| echo "short_hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT |
| echo "long_hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT |
| id: git_hashes |
| |
| - name: Build the Apache Fineract image |
| run: | |
| TAGS=${{ github.ref_name }} |
| if [ "$TAGS" == "develop" ]; then |
| TAGS="$TAGS,${{ steps.git_hashes.outputs.short_hash }},${{ steps.git_hashes.outputs.long_hash }}" |
| else |
| TAGS=$(git tag --points-at HEAD | grep -E '^1\.' | head -n 1 || true) |
| if [ -z "$TAGS" ]; then |
| echo "Skipping DockerHub publish because this run is not for develop or a 1.* tag." |
| exit 0 |
| fi |
| fi |
| ./gradlew --no-daemon --console=plain :fineract-provider:jib -x test -x cucumber -x buildJavaSdk \ |
| -Djib.to.auth.username=${{secrets.DOCKERHUB_USER}} \ |
| -Djib.to.auth.password=${{secrets.DOCKERHUB_TOKEN}} \ |
| -Djib.from.platforms=linux/amd64,linux/arm64 \ |
| -Djib.to.image=apache/fineract \ |
| -Djib.to.tags=$TAGS |