Cortex Build #2
This file contains hidden or 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: "Cortex Build" | |
| on: | |
| workflow_dispatch: | |
| env: | |
| JAVA_VERSION: 21 | |
| JAVA_DISTRIBUTION: 'temurin' | |
| UPLOAD_PERF_HTML_REPORTS: true | |
| jobs: | |
| build-maven: | |
| name: Build-Maven | |
| runs-on: ubuntu-latest | |
| outputs: | |
| ehrbase-version: ${{ steps.get_version.outputs.ehrbase-version }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup - Java 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: ${{ env.JAVA_VERSION }} | |
| distribution: ${{ env.JAVA_DISTRIBUTION }} | |
| cache: 'maven' | |
| - name: Setup - Dependency Cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: deps-${{ runner.os }}-m2-${{ github.head_ref }}-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| deps-${{ runner.os }}-m2-${{ github.head_ref }}- | |
| deps-${{ runner.os }}-m2- | |
| deps-${{ runner.os }}- | |
| deps- | |
| - name: Maven - Verify and Package | |
| run: mvn --batch-mode --update-snapshots --activate-profiles full verify | |
| - name: Maven - Get Version | |
| id: "get_version" | |
| run: | | |
| # evaluate project version | |
| version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
| echo "EHRbase version [$version]" | |
| echo "ehrbase-version=${version}" >> $GITHUB_OUTPUT | |
| - name: Upload - Jar | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ehrbase-jar | |
| path: ./application/target/ehrbase.jar | |
| if-no-files-found: error | |
| retention-days: 1 | |
| docker-build-image: | |
| name: Docker Build Images | |
| runs-on: ubuntu-latest | |
| needs: [ | |
| build-maven | |
| ] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download - Jar | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ehrbase-jar | |
| path: ./application/target/ | |
| - name: Docker - Build Base Image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| load: true | |
| tags: ehrbase/ehrbase:build | |
| - name: Docker - Save Images | |
| run: | | |
| docker save --output ${{ runner.temp }}/ehrbase-build.tar ehrbase/ehrbase:build | |
| - name: Upload - Build Image | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ehrbase-image-build | |
| path: ${{ runner.temp }}/ehrbase-build.tar | |
| if-no-files-found: error | |
| retention-days: 1 | |
| docker-build-push: | |
| name: Docker | |
| uses: ./.github/workflows/cortex-build-push.yml | |
| secrets: inherit | |
| if: ${{ github.actor != 'dependabot[bot]' }} | |
| needs: [ | |
| build-maven, | |
| ] | |
| with: | |
| ehrbase-version: ${{ needs.build-maven.outputs.ehrbase-version }} | |
| ehrbase-jar-artifact: ehrbase-jar |