Skip to content

fix(service-type): rename serviceType into service_type #1774

fix(service-type): rename serviceType into service_type

fix(service-type): rename serviceType into service_type #1774

name: Generate API Clients
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
generate:
runs-on: ubuntu-latest
if: success()
env:
# We only want to publish to client repositories when pushing on main branch
PUBLISH_CLIENTS: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
strategy:
matrix:
include:
- language: go
version: 7.6.0
target-branch: master
deploy-ssh-key: SSH_DEPLOY_KEY_GO
deploy-ssh-key-ws: SSH_DEPLOY_KEY_WS_GO
- language: typescript-axios
version: 7.0.1
target-branch: main
deploy-ssh-key: SSH_DEPLOY_KEY_TYPESCRIPT_AXIOS
deploy-ssh-key-ws: SSH_DEPLOY_KEY_WS_TYPESCRIPT_AXIOS
steps:
- name: Check out source code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.18"
- name: Build OpenApi file
run: |
npm ci
- name: Generate ${{ matrix.language }} client
uses: openapi-generators/openapitools-generator-action@v1
env:
GO_POST_PROCESS_FILE: "/usr/local/bin/gofmt -w"
with:
generator: ${{ matrix.language }}
generator-tag: v${{ matrix.version }}
openapi-file: openapi.yaml
config-file: "generator/configs/${{ matrix.language }}.yaml"
command-args: |
-a bearer \
-o out/qovery-client-${{ matrix.language }} \
--enable-post-process-file \
--git-user-id qovery \
--git-repo-id qovery-client-${{ matrix.language }} \
--package-name qovery \
--additional-properties packageVersion=$(grep 'version' openapi.yaml | head -1 | tr ':' '\n' | tail -1 | tr -d ' ') \
--additional-properties npmVersion=$(grep 'version' openapi.yaml | head -1 | tr ':' '\n' | tail -1 | tr -d ' ')
- name: Generate ${{ matrix.language }} websocket client
uses: openapi-generators/openapitools-generator-action@v1
env:
GO_POST_PROCESS_FILE: "/usr/local/bin/gofmt -w"
with:
generator: ${{ matrix.language }}
generator-tag: v${{ matrix.version }}
openapi-file: websocket/websocket-openapi.yaml
config-file: "generator/configs/${{ matrix.language }}-ws.yaml"
command-args: |
-a bearer \
-o out/qovery-client-ws-${{ matrix.language }} \
--enable-post-process-file \
--git-user-id qovery \
--git-repo-id qovery-client-ws-${{ matrix.language }} \
--package-name qovery-ws \
--additional-properties packageVersion=$(grep 'version' websocket/websocket-openapi.yaml | head -1 | tr ':' '\n' | tail -1 | tr -d ' ') \
--additional-properties npmVersion=$(grep 'version' websocket/websocket-openapi.yaml | head -1 | tr ':' '\n' | tail -1 | tr -d ' ')
- uses: actions/upload-artifact@v4
with:
name: output-${{ matrix.language }}
path: out
- name: Check post generation script existence
id: check_files
uses: andstor/file-existence-action@v1
with:
files: "generator/post_generation_scripts/${{ matrix.language }}.sh"
- name: Check post websocket generation script existence
id: check_files_ws
uses: andstor/file-existence-action@v1
with:
files: "generator/post_generation_scripts/${{ matrix.language }}-ws.sh"
- name: Run ${{ matrix.language }} post generation script
if: steps.check_files.outputs.files_exists == 'true'
run: generator/post_generation_scripts/${{ matrix.language }}.sh
- name: Run ${{ matrix.language }} websocket post generation script
if: steps.check_files.outputs.files_exists == 'true'
run: generator/post_generation_scripts/${{ matrix.language }}-ws.sh
- name: Publish ${{ matrix.language }} client
if: contains(env.PUBLISH_CLIENTS, 'true')
id: push_directory
uses: cpina/github-action-push-to-another-repository@main
env:
SSH_DEPLOY_KEY: ${{ secrets[matrix.deploy-ssh-key] }}
with:
source-directory: out/qovery-client-${{ matrix.language }}
destination-github-username: "qovery"
destination-repository-name: "qovery-client-${{ matrix.language }}"
user-email: [email protected]
commit-message: See ORIGIN_COMMIT from $GITHUB_REF
target-branch: ${{ matrix.target-branch }}
- name: Publish ${{ matrix.language }} websocket client
if: contains(env.PUBLISH_CLIENTS, 'true')
id: push_directory_ws
uses: cpina/github-action-push-to-another-repository@main
env:
SSH_DEPLOY_KEY: ${{ secrets[matrix.deploy-ssh-key-ws] }}
with:
source-directory: out/qovery-client-ws-${{ matrix.language }}
destination-github-username: "qovery"
destination-repository-name: "qovery-client-ws-${{ matrix.language }}"
user-email: [email protected]
commit-message: See ORIGIN_COMMIT from $GITHUB_REF
target-branch: main