Skip to content

feat: initial GitHub support #6

feat: initial GitHub support

feat: initial GitHub support #6

name: Build (Workflows)
on:
push:
paths:
- 'workflows/**'
branches: [main]
pull_request:
paths:
- 'workflows/**'
branches: [main]
concurrency:
# Only run once for latest commit per ref and cancel other (previous) runs.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
PLATFORMS: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
IMAGE_ORG: apicurio
IMAGE_TAG: latest-snapshot
jobs:
build-test:
name: Build and Test Workflows
runs-on: ubuntu-latest
if: github.repository_owner == 'apicurio'
steps:
- name: Checkout Code with Ref '${{ github.ref }}'
uses: actions/checkout@v3
# Set up the JDK
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
# Open-Source Machine emulator that allows you to emulate multiple CPU architectures on your machine
- name: Set up QEMU
if: github.event_name == 'push'
uses: docker/setup-qemu-action@v1
# Docker CLI plugin for extended build capabilities with BuildKit
- name: Set up Docker Buildx
if: github.event_name == 'push'
id: buildx
uses: docker/setup-buildx-action@v1
- name: Inspect builder
if: github.event_name == 'push'
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
- name: Build Workflows
run: |
cd workflows
mvn install -Dmaven.javadoc.skip=true --no-transfer-progress -DtrimStackTrace=false
- name: Login to Quay.io Registry
if: github.event_name == 'push'
run: docker login -u "${{ secrets.QUAY_USERNAME }}" -p "${{ secrets.QUAY_PASSWORD }}" quay.io
- name: Login to DockerHub Registry
if: github.event_name == 'push'
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Build and Publish Docker Image
if: github.event_name == 'SKIP'
uses: docker/build-push-action@v2
with:
context: ./workflows/dist/docker/target/docker
file: ./workflows/dist/docker/target/docker/Dockerfile
platforms: ${{env.PLATFORMS}}
push: true
tags: |
docker.io/${{env.IMAGE_ORG}}/apicurio-api-lifecycle-workflows:${{env.IMAGE_TAG}}
quay.io/${{env.IMAGE_ORG}}/apicurio-api-lifecycle-workflows:${{env.IMAGE_TAG}}
- name: Google Chat Notification (Always)
if: github.event_name == 'push' && always()
uses: Co-qn/google-chat-notification@b9227d9daa4638c9782a5bd16c4abb86268127a1
with:
name: ${{ github.job }}
url: ${{ secrets.GOOGLE_CHAT_WEBHOOK }}
status: ${{ job.status }}
- name: Google Chat Notification (Error)
if: github.event_name == 'push' && failure()
uses: Co-qn/google-chat-notification@b9227d9daa4638c9782a5bd16c4abb86268127a1
with:
name: ${{ github.job }}
url: ${{ secrets.GOOGLE_CHAT_WEBHOOK_ERRORS }}
status: ${{ job.status }}