forked from cryostatio/cryostat-legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (69 loc) · 2.2 KB
/
ci-build-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: build cryostat image
on:
workflow_call:
inputs:
checkout-repo:
required: false
type: string
checkout-ref:
required: false
type: string
build-arch:
required: true
type: string
outputs:
image-version:
description: the Cryostat application version that will be built
value: ${{ jobs.get-pom-properties.outputs.image-version }}
jobs:
get-pom-properties:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: ${{ inputs.checkout-repo }}
ref: ${{ inputs.checkout-ref }}
- id: query-pom
name: Get properties from POM
# Query POM for image version and save as output parameter
run: |
IMAGE_VERSION="$(mvn validate help:evaluate -Dexpression=cryostat.imageVersionLower -q -DforceStdout)"
echo "image-version=$IMAGE_VERSION" >> "$GITHUB_OUTPUT"
outputs:
image-version: ${{ steps.query-pom.outputs.image-version }}
build-image:
runs-on: ubuntu-latest
needs: [get-pom-properties]
steps:
- name: Install qemu
if: ${{ inputs.build-arch != 'amd64' }}
continue-on-error: true
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- uses: actions/checkout@v4
with:
repository: ${{ inputs.checkout-repo }}
ref: ${{ inputs.checkout-ref }}
submodules: true
fetch-depth: 0
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-build-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-build-
${{ runner.os }}-
- run: git submodule init
- run: git submodule update
- run: mvn -B -U -Dbuild.arch=${{ inputs.build-arch }} clean package
- name: Save cryostat image
run: podman save -o cryostat-${{ inputs.build-arch }}.tar --format oci-archive quay.io/cryostat/cryostat
- uses: actions/upload-artifact@v3
with:
name: cryostat-${{ inputs.build-arch }}
path: /home/runner/work/cryostat/cryostat/cryostat-${{ inputs.build-arch }}.tar