chore(libcryostat): clean up to use libcryostat dependency (#261) #1073
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 build and push | |
concurrency: | |
group: ci-${{ github.run_id }} | |
cancel-in-progress: true | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * 1' # every Monday at midnight | |
push: | |
branches: | |
- main | |
- v[0-9]+ | |
- v[0-9]+.[0-9]+ | |
- cryostat-v[0-9]+.[0-9]+ | |
pull_request_target: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- labeled | |
- unlabeled | |
branches: | |
- main | |
- v[0-9]+ | |
- v[0-9]+.[0-9]+ | |
- cryostat-v[0-9]+.[0-9]+ | |
env: | |
CI_USER: cryostat+bot | |
CI_REGISTRY: quay.io/cryostat | |
CI_IMG: quay.io/cryostat/cryostat-reports | |
REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }} | |
REF: ${{ github.event.pull_request.head.ref }} | |
jobs: | |
get-pom-properties: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Fail if PR and safe-to-test label NOT applied | |
if: ${{ github.event_name == 'pull_request_target' && !contains(github.event.pull_request.labels.*.name, 'safe-to-test') }} | |
run: exit 1 | |
- uses: actions/checkout@v3 | |
with: | |
repository: ${{ env.REPOSITORY }} | |
ref: ${{ env.REF }} | |
- id: query-pom | |
name: Get properties from POM | |
# Query POM image version and save as output parameter | |
run: | | |
IMAGE_VERSION="$(mvn validate help:evaluate -Dexpression=quarkus.container-image.tag -q -DforceStdout)" | |
echo "::set-output name=image-version::$IMAGE_VERSION" | |
outputs: | |
image-version: ${{ steps.query-pom.outputs.image-version }} | |
build: | |
runs-on: ubuntu-latest | |
needs: [get-pom-properties] | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
repository: ${{ env.REPOSITORY }} | |
ref: ${{ env.REF }} | |
- 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 }}- | |
- name: Build application | |
run: ./mvnw -Dquarkus.container-image.build=false -B -U clean verify | |
- name: Build container images and manifest | |
id: buildah-build | |
uses: redhat-actions/buildah-build@v2 | |
env: | |
IMAGE_VERSION: ${{ needs.get-pom-properties.outputs.image-version }} | |
with: | |
image: ${{ env.CI_IMG }} | |
oci: true | |
archs: amd64, arm64 | |
tags: ${{ env.IMAGE_VERSION }} ${{ github.ref == 'refs/heads/main' && 'latest' || '' }} | |
containerfiles: | | |
./src/main/docker/Dockerfile.jvm | |
extra-args: | | |
--jobs=2 | |
- name: Push to quay.io | |
id: push-to-quay | |
uses: redhat-actions/push-to-registry@v2 | |
with: | |
image: cryostat-reports | |
tags: ${{ steps.buildah-build.outputs.tags }} | |
registry: ${{ env.CI_REGISTRY }} | |
username: ${{ env.CI_USER }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
if: ${{ github.event_name == 'push' && github.repository_owner == 'cryostatio' }} | |
- name: Print image URL | |
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}" | |
if: ${{ github.event_name == 'push' && github.repository_owner == 'cryostatio' }} |