🏷️ Release Pipeline, create a tag/release for Kaoto Next, publish the NPM and release a container image #26
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: 🏷️ Release Pipeline, create a tag/release for Kaoto Next, publish the NPM and release a container image | |
on: | |
workflow_dispatch: | |
inputs: | |
tag_version: | |
type: string | |
description: | | |
The tag version we want to release without prefix (e.g. 2.0.0) | |
required: true | |
stable: | |
type: boolean | |
description: | | |
Is this a stable release? If so we are going to tag also a stable container image to be used in the Kaoto Operator | |
required: false | |
default: false | |
jobs: | |
tag-and-release: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Bump version and push tag | |
id: tag_version | |
uses: mathieudutour/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
custom_tag: ${{ github.event.inputs.tag_version }} | |
create_annotated_tag: true | |
tag_prefix: "" | |
- name: Create a GitHub release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: ${{ steps.tag_version.outputs.new_tag }} | |
name: Release ${{ steps.tag_version.outputs.new_tag }} | |
npm-release: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
needs: | |
- tag-and-release | |
steps: | |
- name: "🛰️ Checkout source code" | |
uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
registry-url: 'https://registry.npmjs.org' | |
scope: '@kaoto' | |
cache: 'yarn' | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
cache: 'maven' | |
- name: 🔧 Install dependencies | |
run: yarn | |
# Build lib | |
- name: Build @kaoto/kaoto package in lib mode | |
run: yarn workspace @kaoto/kaoto run build:lib | |
# Version and publish | |
- name: 'Version and publish' | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.KAOTO_NPM_TOKEN }} | |
run: yarn publish | |
container-image-release: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
needs: | |
- tag-and-release | |
- npm-release | |
steps: | |
- name: "🛰️ Checkout source code" | |
uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
registry-url: 'https://registry.npmjs.org' | |
scope: '@kaoto' | |
cache: 'yarn' | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
cache: 'maven' | |
- name: 🔧 Install dependencies | |
run: yarn | |
- name: "🔧 Build packages" | |
run: | | |
yarn workspaces foreach --verbose --all --topological-dev --exclude @kaoto/camel-catalog --exclude @kaoto/camel-catalog-plugin run build | |
- name: "🛰️ Login to Container Registry" | |
uses: docker/login-action@v3 | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_USERNAME }} | |
password: ${{ secrets.QUAY_PASSWORD }} | |
- name: "🔧 Build Container Image" | |
shell: bash | |
run: | | |
docker build -t "quay.io/kaotoio/kaoto-app:${{ github.event.inputs.tag_version }}" . | |
- name: "📤 Upload Container Image" | |
shell: bash | |
run: | | |
docker push quay.io/kaotoio/kaoto-app:${{ github.event.inputs.tag_version }} | |
- name: "🔧 Build Container Image" | |
shell: bash | |
run: | | |
docker build -t "quay.io/kaotoio/kaoto-app:stable" . | |
if: ${{ github.event.inputs.stable }} | |
- name: "📤 Upload Container Image" | |
shell: bash | |
run: | | |
docker push quay.io/kaotoio/kaoto-app:stable | |
if: ${{ github.event.inputs.stable }} |