👷 ci generation #4
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
name: OpenAPI Client Generator | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- v2 | |
jobs: | |
generate: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Checkout Latest Code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: '21' | |
- name: Install dependencies | |
run: npm clean-install | |
- name: Verify NPM Signatures | |
run: npm audit signatures | |
- name: Generate OpenAPI Client | |
run: npm run generate | |
- name: Get OpenAPI YAML | |
id: yaml | |
run: | | |
spec="$(curl -LsSf ${{ env.OPENAPI_URL }})" | |
echo "${spec}" | |
echo spec="${spec}" >> ${GITHUB_OUTPUT} | |
env: | |
OPENAPI_URL: https://lm-v2-api-mock-data-f24357049a1b.herokuapp.com/v2/openapi | |
- name: Get OpenAPI JSON | |
id: json | |
uses: mikefarah/yq@master | |
with: | |
cmd: echo "${{ steps.yaml.outputs.spec }}" | yq --output-format json | |
env: | |
OPENAPI_URL: https://lm-v2-api-mock-data-f24357049a1b.herokuapp.com/v2/openapi | |
- name: Get OpenAPI Spec Version | |
id: version | |
run: | | |
version=$(echo "${{ steps.json.outputs.result }}" | jq -r .info.version) | |
echo version=${version} >> ${GITHUB_OUTPUT} | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
add-paths: clients | |
commit-message: ✨ lunchmoney openapi spec v${{ steps.version.outputs.version }} | |
branch: openapi/v${{ steps.version.outputs.version }} | |
delete-branch: true | |
title: ✨ lunchmoney openapi spec v${{ steps.version.outputs.version }} |