Skip to content

Refactor OpenAPI generation script to use ES modules and update TypeS… #32

Refactor OpenAPI generation script to use ES modules and update TypeS…

Refactor OpenAPI generation script to use ES modules and update TypeS… #32

Workflow file for this run

name: Deploy Core
on:
push:
branches: [main]
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Generate OpenAPI spec
run: |
npm run openapi
npx prettier --write openapi.json || true
- name: Commit OpenAPI spec if changed
id: commit_spec
run: |
if git diff --quiet openapi.json; then
echo "No spec changes";
echo "spec_updated=false" >> $GITHUB_OUTPUT
else
git config user.name "github-actions"
git config user.email "actions@users.noreply.github.com"
git add openapi.json
git commit -m "chore: update openapi spec"
git push
echo "spec_updated=true" >> $GITHUB_OUTPUT
fi
- name: Prettify code
if: steps.commit_spec.outputs.spec_updated == 'false'
run: npm run prettify
- name: Deploy to Cloudflare Workers
if: steps.commit_spec.outputs.spec_updated == 'false'
run: npx wrangler deploy
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}