Skip to content

1.0.0.Beta1

1.0.0.Beta1 #11

Workflow file for this run

name: Release Images
on:
workflow_dispatch:
inputs:
tag:
description: 'Release tag name'
required: true
release:
types: [released, prereleased]
env:
PLATFORMS: linux/amd64,linux/arm64,linux/s390x,linux/ppc64le
IMAGE_ORG: apicurio
# The below values are extracted from the github.event context,
# which is only available when the workflow gets triggered by a release event.
RELEASE_VERSION: ${{ github.event.release.name }}
BRANCH: ${{ github.event.release.target_commitish }}
jobs:
release-images:
if: github.repository_owner == 'Apicurio'
runs-on: ubuntu-20.04
steps:
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20
# Open-Source Machine emulator that allows you to emulate multiple CPU architectures on your machine
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
# Docker CLI plugin for extended build capabilities with BuildKit
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Inspect builder
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 }}"
# Setting Env variables explicitly
# Release context is not available for manual trigger(workflow_dispatch)
- name: Fetch Release Details
if: github.event_name == 'workflow_dispatch'
run: |
touch release.json && curl https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/${{ github.event.inputs.tag }} > release.json
echo "RELEASE_VERSION=$(cat release.json | jq -r '.name')" >> $GITHUB_ENV
echo "BRANCH=$(cat release.json | jq -r '.target_commitish')" >> $GITHUB_ENV
- name: Download Source Code
run: git clone --branch $RELEASE_VERSION --single-branch ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git studio
# We have faced issues in the past where a github release was created from a wrong commit
# This step will ensure that the release was created from the right commit
- name: Verify Project Version
run: |
cd studio
PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
if [[ $PROJECT_VERSION != $RELEASE_VERSION ]]
then
echo "ERROR: Project Version '${PROJECT_VERSION}' does not match with Released Version '${RELEASE_VERSION}'"
exit 1
fi
- name: Build Apicurio Studio
run: |
cd studio
mvn install -Pprod -DskipTests=true -Dmaven.javadoc.skip=true --no-transfer-progress -DtrimStackTrace=false
cd ui
npm install
npm run build
npm run package
- name: Login to Quay.io Registry
run: docker login -u "${{ secrets.QUAY_USERNAME }}" -p "${{ secrets.QUAY_PASSWORD }}" quay.io
- name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
- name: Build and Publish Docker Image (Backend)
uses: docker/build-push-action@v2
with:
context: ./studio/dist/docker/target/docker
file: ./studio/dist/docker/target/docker/Dockerfile.jvm
platforms: ${{env.PLATFORMS}}
push: true
tags: |
docker.io/${{env.IMAGE_ORG}}/apicurio-studio:${{env.RELEASE_VERSION}}
docker.io/${{env.IMAGE_ORG}}/apicurio-studio:latest
quay.io/${{env.IMAGE_ORG}}/apicurio-studio:${{env.RELEASE_VERSION}}
quay.io/${{env.IMAGE_ORG}}/apicurio-studio:latest
- name: Build and Publish Docker Image (UI)
uses: docker/build-push-action@v2
with:
context: ./studio/ui
file: ./studio/ui/Dockerfile
platforms: ${{env.PLATFORMS}}
push: true
tags: |
docker.io/${{env.IMAGE_ORG}}/apicurio-studio-ui:${{env.RELEASE_VERSION}}
docker.io/${{env.IMAGE_ORG}}/apicurio-studio-ui:latest
quay.io/${{env.IMAGE_ORG}}/apicurio-studio-ui:${{env.RELEASE_VERSION}}
quay.io/${{env.IMAGE_ORG}}/apicurio-studio-ui:latest
- name: Google Chat Notification (Always)
if: 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: failure()
uses: Co-qn/google-chat-notification@b9227d9daa4638c9782a5bd16c4abb86268127a1
with:
name: ${{ github.job }}
url: ${{ secrets.GOOGLE_CHAT_WEBHOOK_ERRORS }}
status: ${{ job.status }}