Skip to content

refactor: migrate to jdbi (#241) #278

refactor: migrate to jdbi (#241)

refactor: migrate to jdbi (#241) #278

Workflow file for this run

name: Openapi and Clients
on:
release:
push:
branches:
- main
- dev
workflow_dispatch:
jobs:
generate-openapi-and-clients:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
services:
valkey:
image: valkey/valkey:9-alpine
ports:
- 6379:6379
postgres:
image: postgres:18-alpine
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: admin
POSTGRES_DB: zoot
ports:
- 5432:5432
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
ref: ${{ github.ref_name }}
fetch-depth: 0
- name: Git Version
id: version
uses: codacy/git-version@2.7.1
with:
release-branch: main
dev-branch: dev
major-identifier: "breaking:"
minor-identifier: "/^(feat|refactor):/"
- name: Setup Java
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 25
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
- name: Set versions
run: |
sed -i "s/^version.*$/version = \"${{ steps.version.outputs.version }}\"/g" build.gradle.kts
sed -i 's/"packageVersion.*,/"packageVersion": "${{ steps.version.outputs.version }}",/g' client-config/cpp.json
sed -i 's/"packageVersion.*,/"packageVersion": "${{ steps.version.outputs.version }}",/g' client-config/csharp-netcore.json
sed -i 's/"packageVersion.*,/"packageVersion": "${{ steps.version.outputs.version }}",/g' client-config/rust.json
sed -i 's/"npmVersion.*,/"npmVersion": "${{ steps.version.outputs.version }}",/g' client-config/ts-fetch.json
- name: Generate dev profile
run: cp ./src/main/resources/application-template.yml ./src/main/resources/application-dev.yml
- name: Generate OpenAPI spec and all clients
env:
MAA_COPILOT_SEGMENT_ENABLED: false
run: ./gradlew generateSwaggerCode
- name: Upload OpenAPI spec
uses: actions/upload-artifact@v7
with:
name: openapi-${{ steps.version.outputs.version }}
path: build/docs/swagger.json
- name: Upload C++ client
uses: actions/upload-artifact@v7
with:
name: cpp-client
path: build/clients/cpp-client/
- name: Upload C# client
uses: actions/upload-artifact@v7
with:
name: csharp-client
path: build/clients/csharp-client/
- name: Upload Rust client
uses: actions/upload-artifact@v7
with:
name: rust-client
path: build/clients/rust-client/
- name: Upload TS client
uses: actions/upload-artifact@v7
with:
name: ts-client
path: build/clients/ts-fetch-client/
- name: Checkout zoot-plus-client-ts
uses: actions/checkout@v6
with:
repository: ZOOT-Plus/zoot-plus-client-ts
path: zoot-plus-client-ts
token: ${{ secrets.TS_CLIENT_PAT }}
- name: Publish TS client
run: |
set -e
# Remove stale files from previous builds (keep .git)
find zoot-plus-client-ts -mindepth 1 -maxdepth 1 -not -name '.git' -exec rm -rf {} +
cp -rf build/clients/ts-fetch-client/* zoot-plus-client-ts/
cd zoot-plus-client-ts
git diff --quiet && exit 0
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "release: ${{ steps.version.outputs.version }}" \
-m "Generated from ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
git tag "${{ steps.version.outputs.version }}"
git push
git push --tags