Skip to content

Commit 7f6eed9

Browse files
committed
feat: refactor makefile and cli
Signed-off-by: Ruben Romero Montes <rromerom@redhat.com>
1 parent e845cef commit 7f6eed9

File tree

15 files changed

+656
-369
lines changed

15 files changed

+656
-369
lines changed

.github/workflows/publish-api-models.yml

Lines changed: 0 additions & 106 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Release API Models
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'API specification version to release (e.g., v1, v2)'
8+
required: true
9+
default: 'v1'
10+
release_java:
11+
description: 'Release Java models'
12+
required: false
13+
default: true
14+
type: boolean
15+
release_typescript:
16+
description: 'Release TypeScript models'
17+
required: false
18+
default: true
19+
type: boolean
20+
21+
jobs:
22+
release-models:
23+
runs-on: ubuntu-latest
24+
permissions:
25+
contents: read
26+
packages: write
27+
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v4
31+
32+
- name: Set up JDK 21
33+
uses: actions/setup-java@v4
34+
with:
35+
java-version: '21'
36+
distribution: 'temurin'
37+
38+
- name: Set up Node.js
39+
uses: actions/setup-node@v4
40+
with:
41+
node-version: '20'
42+
registry-url: 'https://npm.pkg.github.com'
43+
scope: '@trustification'
44+
45+
- name: Cache Maven packages
46+
uses: actions/cache@v4
47+
with:
48+
path: ~/.m2
49+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
50+
restore-keys: ${{ runner.os }}-m2
51+
52+
- name: Cache npm dependencies
53+
uses: actions/cache@v4
54+
with:
55+
path: ~/.npm
56+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
57+
restore-keys: |
58+
${{ runner.os }}-node-
59+
60+
- name: Get API version
61+
id: api-version
62+
run: |
63+
if [ "${{ github.event.inputs.version }}" != "" ]; then
64+
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
65+
else
66+
echo "version=v1" >> $GITHUB_OUTPUT
67+
fi
68+
69+
- name: Build and Release Java Models
70+
if: ${{ github.event.inputs.release_java != 'false' }}
71+
run: |
72+
echo "📦 Building and releasing Java models..."
73+
cd api-models/java
74+
# Set the release version
75+
mvn versions:set -DnewVersion=${{ steps.api-version.outputs.version }} -DgenerateBackupPoms=false
76+
mvn clean generate-sources compile -Dapi.version=${{ steps.api-version.outputs.version }}
77+
mvn deploy -Dapi.version=${{ steps.api-version.outputs.version }}
78+
# Reset to SNAPSHOT version
79+
mvn versions:set -DnewVersion=1.0.0-SNAPSHOT -DgenerateBackupPoms=false
80+
echo "✅ Java models released successfully"
81+
env:
82+
GITHUB_ACTOR: ${{ github.actor }}
83+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
85+
- name: Build and Release TypeScript Models
86+
if: ${{ github.event.inputs.release_typescript != 'false' }}
87+
run: |
88+
echo "📦 Building and releasing TypeScript models..."
89+
cd api-models/typescript
90+
# Set the release version
91+
npm version ${{ steps.api-version.outputs.version }} --no-git-tag-version
92+
npm ci
93+
npm run generate --version ${{ steps.api-version.outputs.version }}
94+
npm run build
95+
npm publish
96+
# Reset to SNAPSHOT version
97+
npm version 1.0.0-SNAPSHOT --no-git-tag-version
98+
echo "✅ TypeScript models released successfully"
99+
env:
100+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101+
102+
- name: Summary
103+
run: |
104+
echo "🎉 API Models release completed!"
105+
echo "Version: ${{ steps.api-version.outputs.version }}"
106+
echo "Java models: ${{ github.event.inputs.release_java != 'false' && '✅ Released' || '⏭️ Skipped' }}"
107+
echo "TypeScript models: ${{ github.event.inputs.release_typescript != 'false' && '✅ Released' || '⏭️ Skipped' }}"

0 commit comments

Comments
 (0)