Merge pull request #50 from JavatoDev-com/49-keycloak-realm-export-se… #104
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI For Concept Microservice | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: { dir: [ | |
'core-banking-service', | |
'internet-banking-config-server', | |
'internet-banking-fund-transfer-service', | |
'internet-banking-user-service', | |
'internet-banking-utility-payment-service', | |
'internet-banking-service-registry', | |
'internet-banking-api-gateway' | |
] } | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0 | |
- name: Build | |
run: ./gradlew build -x test | |
working-directory: ${{ matrix.dir }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.dir }}-artifacts | |
path: | | |
${{ matrix.dir }}/build/libs/${{ matrix.dir }}*SNAPSHOT.jar | |
${{ matrix.dir }}/Dockerfile | |
${{ matrix.dir }}/wait-for-it.sh | |
retention-days: 1 | |
overwrite: true | |
docker_publish: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: { dir: [ | |
'core-banking-service', | |
'internet-banking-config-server', | |
'internet-banking-fund-transfer-service', | |
'internet-banking-user-service', | |
'internet-banking-utility-payment-service', | |
'internet-banking-service-registry', | |
'internet-banking-api-gateway' | |
] } | |
permissions: | |
contents: read | |
packages: write | |
needs: build | |
steps: | |
- name: Download latest build artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ matrix.dir }}-artifacts | |
- name: Move artifacts to the correct directory | |
shell: bash | |
run: | | |
ls -lrt | |
mkdir -p ${{ matrix.dir }}-downloaded-artifacts | |
mv build ${{ matrix.dir }}-downloaded-artifacts | |
mv Dockerfile ${{ matrix.dir }}-downloaded-artifacts | |
mv wait-for-it.sh ${{ matrix.dir }}-downloaded-artifacts | |
- name: Validate moved artifacts | |
run: ls -lrt | |
working-directory: ${{ matrix.dir }}-downloaded-artifacts | |
- name: Build Docker images | |
run: docker build -t javatodev/${{ matrix.dir }} . | |
working-directory: ${{ matrix.dir }}-downloaded-artifacts | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Push Docker image to GitHub Container Registry | |
run: docker push javatodev/${{ matrix.dir }} |