Specifiy image names explictly in docker metadata GH-action step #115
Workflow file for this run
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: Build | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
types: [ opened, synchronize, reopened ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Java | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: maven | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build with Maven | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: mvn -B clean verify -Pcoverage | |
- name: Test Image Build | |
if: github.ref_name != 'main' | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: false | |
file: Dockerfile | |
- name: Login to Quay | |
if: github.event_name == 'push' && github.ref_name == 'main' | |
uses: docker/login-action@v3 | |
with: | |
registry: "${{ secrets.IMAGE_REPO_HOSTNAME }}" | |
username: "${{ secrets.IMAGE_REPO_USERNAME }}" | |
password: "${{ secrets.IMAGE_REPO_PASSWORD }}" | |
- name: Image metadata | |
if: github.event_name == 'push' && github.ref_name == 'main' | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
streamshub/flink-sql-runner | |
quay.io/streamshub/flink-sql-runner | |
- name: Build and Push Image | |
if: github.event_name == 'push' && github.ref_name == 'main' | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
file: Dockerfile | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
## Save the context information for use in Sonar analysis | |
- name: Save Build Context | |
run: | | |
mkdir -vp target | |
echo "$GITHUB_CONTEXT" > target/build-context.json | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
## Attach the target directory for use in Sonar analysis | |
- name: Attach Build Output | |
uses: actions/upload-artifact@v4 | |
with: | |
name: target | |
path: | | |
**/target/ | |
!flink-sql-runner-dist/** | |
!**/target/**.jar | |
!**/target/failsafe-reports/**/* | |
!**/target/surefire-reports/**/* |