|
3 | 3 | push: |
4 | 4 | branches: |
5 | 5 | - main |
6 | | - pull_request_target: |
7 | | - branches: |
8 | | - - main |
| 6 | + pull_request: |
9 | 7 |
|
10 | 8 | jobs: |
11 | 9 | build: |
12 | 10 | runs-on: ubuntu-22.04 |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + java-major-version: [11, 21] |
| 14 | + platform: [linux/amd64, linux/arm64] |
13 | 15 | steps: |
14 | | - # Set fetch-depth: 0 to fetch commit history and tags for use in version calculation |
15 | | - - name: Check out code |
16 | | - uses: actions/checkout@v3 |
17 | | - with: |
18 | | - fetch-depth: 0 |
| 16 | + - name: Checkout |
| 17 | + uses: actions/checkout@v4 |
| 18 | + |
| 19 | + - name: Set up QEMU |
| 20 | + uses: docker/setup-qemu-action@v3 |
| 21 | + |
| 22 | + - name: Set up Docker Buildx |
| 23 | + uses: docker/setup-buildx-action@v3 |
19 | 24 |
|
20 | 25 | - name: Login to Docker Hub |
21 | | - uses: docker/login-action@v2 |
| 26 | + uses: docker/login-action@v3 |
22 | 27 | with: |
23 | 28 | username: ${{ secrets.DOCKERHUB_READ_USER }} |
24 | 29 | password: ${{ secrets.DOCKERHUB_READ_TOKEN }} |
25 | 30 |
|
26 | | - - name: Build with Gradle |
27 | | - uses: hypertrace/github-actions/gradle@main |
28 | | - with: |
29 | | - args: dockerBuildImages |
| 31 | + - name: Read Java Version |
| 32 | + shell: bash |
| 33 | + id: versions |
| 34 | + run: | |
| 35 | + ZULU_JDK_VERSION=`cat java-${{ matrix.java-major-version}}/java.version` |
| 36 | + echo ZULU_JDK_VERSION=${ZULU_JDK_VERSION} >> $GITHUB_OUTPUT |
30 | 37 |
|
31 | | - - name: Scan java-11 image |
32 | | - uses: hypertrace/github-actions/trivy-image-scan@main |
| 38 | + - name: Build java-${{ matrix.java-major-version}} |
| 39 | + uses: docker/build-push-action@v5 |
33 | 40 | with: |
34 | | - image: hypertrace/java |
35 | | - tag: 11 |
36 | | - category: java-11 |
37 | | - output-mode: github |
| 41 | + context: java-${{ matrix.java-major-version}} |
| 42 | + platforms: ${{ matrix.platform }} |
| 43 | + build-args: | |
| 44 | + JAVA_VERSION=${{ steps.versions.outputs.ZULU_JDK_VERSION }} |
| 45 | + tags: hypertrace/java-build:${{ matrix.java-major-version}} |
| 46 | + load: true |
38 | 47 |
|
39 | | - - name: Scan java-21 image |
| 48 | + - name: Scan java-${{ matrix.java-major-version}} image |
40 | 49 | uses: hypertrace/github-actions/trivy-image-scan@main |
41 | 50 | with: |
42 | | - image: hypertrace/java |
43 | | - tag: 21 |
44 | | - category: java-21 |
| 51 | + image: hypertrace/java-build |
| 52 | + tag: ${{ matrix.java-major-version}} |
| 53 | + category: java-${{ matrix.java-major-version}} |
45 | 54 | output-mode: github |
0 commit comments