Skip to content

Commit

Permalink
fix build workflow
Browse files Browse the repository at this point in the history
Signed-off-by: ruromero <rromerom@redhat.com>
  • Loading branch information
ruromero committed Feb 16, 2023
1 parent 502df75 commit 68094ea
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
58 changes: 29 additions & 29 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,51 +6,51 @@ on:
- 'main'
tags:
- 'v**'
env:
REGISTRY: quay.io
IMAGE_NAME: cloudevents-player
JAVA_VERSION: '17'

jobs:
build:
runs-on: ubuntu-latest
name: "Build native images"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up graalVM
uses: graalvm/setup-graalvm@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
version: 'latest'
java-version: '17'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build the project
run: |
./mvnw package -Pnative
install: true
- name: Define tags
shell: bash
run: |
POM_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
VERSION=v${POM_VERSION%-SNAPSHOT}
if [ ${{ github.ref }} == 'refs/heads/main' ]; then
echo "docker_tag=latest ${VERSION}" >> $GITHUB_OUTPUT
else
echo "docker_tag=${VERSION}" >> $GITHUB_OUTPUT
fi
echo "docker_tag=${VERSION}" >> $GITHUB_OUTPUT
id: build_tags
- name: Build the container image
id: build-image
uses: redhat-actions/buildah-build@v2
- name: Setup Java
uses: actions/setup-java@v3
with:
image: cloudevents-player
tags: ${{ steps.build_tags.outputs.docker_tag }}
archs: amd64, arm64
dockerfiles: |
./src/main/docker/Dockerfile.native-micro
- name: Push to registry
id: push-to-quay
uses: redhat-actions/push-to-registry@v2
java-version: ${{ env.JAVA_VERSION }}
distribution: temurin
cache: maven
- name: Log in to Quay
uses: docker/login-action@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: quay.io/ruben
registry: ${{ env.REGISTRY }}
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Build the project
run: |
if [ ${{ github.ref }} == 'refs/heads/main' ]; then
additional_tags="-Dquarkus.container-image.additional-tags=latest"
fi
./mvnw -B clean package -Dcontainer \
-Dquarkus.docker.buildx.platform=linux/amd64,linux/arm64 \
-Dquarkus.native.container-build=true \
-Dquarkus.docker.buildx.output=type=registry \
-Dquarkus.container-image.tag=${{ steps.build_tags.outputs.docker_tag }} \
${additional_tags:-}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-container-image-jib</artifactId>
<artifactId>quarkus-container-image-docker</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
Expand Down

0 comments on commit 68094ea

Please sign in to comment.