From 41e8ce431919c7a97dd3f25cdc7433b10e580d2a Mon Sep 17 00:00:00 2001 From: Gil Desmarais Date: Fri, 1 May 2026 15:02:10 +0200 Subject: [PATCH] ci: automate openapi artifact regeneration on release PRs --- .github/release-please-config.json | 14 +++++++++++++- .github/workflows/ci.yml | 20 ++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/.github/release-please-config.json b/.github/release-please-config.json index bb93a2bc..47131b1c 100644 --- a/.github/release-please-config.json +++ b/.github/release-please-config.json @@ -4,7 +4,19 @@ "release-type": "ruby", "package-name": "html2rss-web", "version-file": "config/version.rb", - "changelog-path": "CHANGELOG.md" + "changelog-path": "CHANGELOG.md", + "extra-files": [ + { + "type": "json", + "path": "frontend/package.json", + "jsonpath": "$.version" + }, + "public/openapi.yaml", + "frontend/src/api/generated/client.gen.ts", + "frontend/src/api/generated/sdk.gen.ts", + "frontend/src/api/generated/types.gen.ts", + "frontend/src/api/generated/index.ts" + ] } } } diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb6f2193..18c8e7e3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,6 +49,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 + with: + token: ${{ secrets.RELEASE_PLEASE_TOKEN || github.token }} - uses: ruby/setup-ruby@v1 with: @@ -71,7 +73,25 @@ jobs: working-directory: frontend - name: Verify generated OpenAPI spec and client are up to date + id: verify run: make openapi-verify + continue-on-error: ${{ startsWith(github.head_ref, 'release-please--') }} + + - name: Regenerate and commit OpenAPI artifacts on release PRs + if: steps.verify.outcome == 'failure' && startsWith(github.head_ref, 'release-please--') + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + + make openapi + make openapi-client + + git add public/openapi.yaml frontend/src/api/generated/ + git commit -m "chore: regenerate openapi spec and client for version bump" + git push + + echo "## OpenAPI artifacts regenerated" >> "$GITHUB_STEP_SUMMARY" + echo "Version bump detected; OpenAPI spec and frontend client have been regenerated and committed." >> "$GITHUB_STEP_SUMMARY" - name: Lint OpenAPI contract run: make openapi-lint