chore: publish openapi specs on release (#24607)

This commit is contained in:
Michael Geers 2025-10-21 09:27:00 +02:00 • committed by GitHub
parent af5aa57fc6
commit 6aeb83e109
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 58 additions and 0 deletions

View file

@ -39,3 +39,36 @@ jobs:
allow_empty_commit: false
commit_message: ${{ github.event_name == 'release' && 'Templates update for release' || github.event_name == 'schedule' && 'Templates update for nightly' || 'Templates update unknown trigger' }}
if: success()
openapi:
name: Deploy OpenAPI spec
runs-on: depot-ubuntu-24.04-arm
permissions:
contents: read
# run on release or manual trigger, but not on schedule
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- name: Prepare OpenAPI spec
run: |
mkdir -p ./openapi-deploy
cp ./server/openapi.yaml ./openapi-deploy/openapi.yaml
- name: Deploy OpenAPI spec to docs repo
uses: peaceiris/actions-gh-pages@v4
with:
personal_token: ${{ secrets.DOCS_DEPLOY_TOKEN }}
publish_dir: ./openapi-deploy
external_repository: evcc-io/docs
publish_branch: main
destination_dir: static
allow_empty_commit: false
commit_message: Update OpenAPI spec
keep_files: true
if: success()

25
.github/workflows/openapi-validate.yml vendored Normal file
View file

@ -0,0 +1,25 @@
name: openapi-validate
permissions:
contents: read
on:
workflow_dispatch:
pull_request:
paths:
- "server/openapi.yaml"
- ".github/workflows/openapi-validate.yml"
jobs:
validate-openapi:
name: Validate OpenAPI spec
runs-on: depot-ubuntu-24.04-arm
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup Go
uses: actions/setup-go@v6
with:
go-version: stable
- name: Validate OpenAPI spec
run: go run github.com/getkin/kin-openapi/cmd/validate@v0.133.0 -- server/openapi.yaml