Skip to content

Generate Java Fabric8 Model From CRD #3

Generate Java Fabric8 Model From CRD

Generate Java Fabric8 Model From CRD #3

name: Generate Java Fabric8 Model From CRD
on:
workflow_dispatch:
inputs:
fabric8Version:
type: string
default: "6.5.1"
required: true
description: 'Fabric8 version'
clientTag:
type: string
required: true
description: 'Kubernetes Java Fabric8 Client tag. (will be generated)'
isPrerelease:
type: boolean
default: true
required: true
description: 'Is this a prerelease of Kubernetes Java client?'
env:
GEN_DIR: .
permissions:
contents: write
jobs:
generate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Release name
run: |
sudo apt-get update && sudo apt-get install xmlstarlet -y
xmlstarlet edit -L -N p=http://maven.apache.org/POM/4.0.0 --update '/p:project/p:version' --value ${{ github.event.inputs.clientTag }} pom.xml
- name: Fetch CRDs
run: |
rm -rf src/
- name: Configure Code Generator
run: |
wget https://oss.sonatype.org/content/repositories/releases/io/fabric8/java-generator-cli/${{ github.event.inputs.fabric8Version }}/java-generator-cli-${{ github.event.inputs.fabric8Version }}.sh
mv java-generator-cli-${{ github.event.inputs.fabric8Version }}.sh java-gen
chmod +x java-gen
mv java-gen /usr/local/bin/
- name: Generate Models for External CRDs
run: |
sudo /usr/local/bin/java-gen -s crds/external --target src/main/java
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "build(ci): generate fabric8 models for version ${{ github.event.inputs.clientTag }}"
tagging_message: ${{ github.event.inputs.clientTag }}
- uses: ncipollo/release-action@v1
with:
artifacts: target/external-fabric8-models*.jar"
tag: ${{ github.event.inputs.clientTag }}
name: ${{ github.event.inputs.clientTag }}
prerelease: "${{ github.event.inputs.isPrerelease }}"
body: |
This release (${{ github.event.inputs.clientTag }}) supports [these CRDs](https://github.com/robolaunch/external-fabric8-models/tree/${{ github.event.inputs.clientTag }}/crds/external).
- uses: actions/upload-artifact@v3
with:
name: generated-java-crd-model
path: |
${{ env.GEN_DIR }}