Skip to content

Commit

Permalink
Merge pull request #354 from openmeterio/ci/node-client-generation
Browse files Browse the repository at this point in the history
ci(api): add Node.js client generation workflow
  • Loading branch information
tothandras authored Oct 26, 2023
2 parents 7c982b8 + 88faaf2 commit a0e38a7
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/generate-client-node.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Node.js Client Generation

permissions:
pull-requests: write

on:
push:
branches:
- main
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-dev.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+"
paths:
- api/openapi.yaml
- ".github/workflows/generate-node-client.yaml"

env:
NEW_BRANCH: openapi-${GITHUB_SHA::7}/node-clientgen

jobs:
generate:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Checkout new Branch
run: git checkout -b ${{ env.NEW_BRANCH }}
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: "20"
cache: "npm"
cache-dependency-path: "./api/client/node/package-lock.json"
- name: Install Dependencies
run: npm ci
working-directory: ./api/client/node
- name: Generate Client
run: npm run generate
working-directory: ./api/client/node
- name: Bump Version
run: |
npm version patch -m "chore(api): bump Node.js client version to %s"
working-directory: ./api/client/node
- name: Commit and push changes
run: |
git config --global user.email "github-actions[bot]"
git config --global user.name "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "chore(api): generate node client"
git push origin ${{ env.NEW_BRANCH }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Open PR
run: |
gh pr create \
--title "[bot] Re-generate Node.js client" \
--body "This PR was automatically generated." \
--base main \
--head ${{ env.NEW_BRANCH }} \
--repo ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit a0e38a7

Please sign in to comment.