-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…#148) * ci(push): add config for CI build and publish on push (#147) (cherry picked from commit b57640d) * ci(push): fix container stream name (#149) (#150) (cherry picked from commit 9bd6ee6) # Conflicts: # .github/workflows/push-ci.yaml Co-authored-by: Andrew Azores <aazores@redhat.com> Co-authored-by: Andrew Azores <aazores@redhat.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
46a0201
commit a284e55
Showing
3 changed files
with
99 additions
and
9 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: CI build and publish | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- v[0-9]+ | ||
- v[0-9]+.[0-9]+ | ||
- cryostat-v[0-9]+.[0-9]+ | ||
|
||
jobs: | ||
get-pom-properties: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- id: query-pom | ||
name: Get properties from POM | ||
# Query POM for image version and save as output parameter | ||
run: | | ||
IMAGE_NAME="$(mvn validate help:evaluate -Dexpression=project.artifactId -q -DforceStdout)" | ||
echo "::set-output name=image-name::$IMAGE_NAME" | ||
IMAGE_VERSION="$(mvn validate help:evaluate -Dexpression=imageVersionLower -q -DforceStdout)" | ||
echo "::set-output name=image-version::$IMAGE_VERSION" | ||
outputs: | ||
image-name: ${{ steps.query-pom.outputs.image-name }} | ||
image-version: ${{ steps.query-pom.outputs.image-version }} | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
needs: [get-pom-properties] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-java@v2 | ||
with: | ||
java-version: '17' | ||
distribution: 'adopt' | ||
- uses: actions/cache@v2 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
- run: mvn -Pnative -Dquarkus.native.container-build=true -Dquarkus.native.container-runtime=podman -Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-mandrel:21.3-java17 clean verify | ||
- run: podman build -f src/main/docker/Dockerfile.native -t "quay.io/cryostat/$IMAGE_NAME:$IMAGE_VERSION" . | ||
env: | ||
IMAGE_NAME: ${{ needs.get-pom-properties.outputs.image-name }} | ||
IMAGE_VERSION: ${{ needs.get-pom-properties.outputs.image-version }} | ||
if: ${{ github.event_name == 'push' && github.repository_owner == 'cryostatio' }} | ||
- name: Tag images | ||
id: tag-image | ||
env: | ||
IMAGE_NAME: ${{ needs.get-pom-properties.outputs.image-name }} | ||
IMAGE_VERSION: ${{ needs.get-pom-properties.outputs.image-version }} | ||
run: | | ||
if [ "$GITHUB_REF" == "refs/heads/main" ]; then | ||
podman tag \ | ||
quay.io/cryostat/$IMAGE_NAME:$IMAGE_VERSION \ | ||
quay.io/cryostat/$IMAGE_NAME:latest | ||
echo "::set-output name=tags::$IMAGE_VERSION latest" | ||
else | ||
echo "::set-output name=tags::$IMAGE_VERSION" | ||
fi | ||
if: ${{ github.event_name == 'push' && github.repository_owner == 'cryostatio' }} | ||
- name: Push to quay.io | ||
id: push-to-quay | ||
uses: redhat-actions/push-to-registry@v2 | ||
with: | ||
image: ${{ needs.get-pom-properties.outputs.image-name }} | ||
tags: ${{ steps.tag-image.outputs.tags }} | ||
registry: quay.io/cryostat | ||
username: cryostat+bot | ||
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' }} |
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