From 6aeb83e109c6e40b1451d5b8f811d91a56007400 Mon Sep 17 00:00:00 2001 From: Michael Geers Date: Tue, 21 Oct 2025 09:27:00 +0200 Subject: [PATCH] chore: publish openapi specs on release (#24607) --- .github/workflows/documentation.yml | 33 ++++++++++++++++++++++++++ .github/workflows/openapi-validate.yml | 25 +++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 .github/workflows/openapi-validate.yml diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index dabbf061c..a686e96bc 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -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() diff --git a/.github/workflows/openapi-validate.yml b/.github/workflows/openapi-validate.yml new file mode 100644 index 000000000..cb0b56ec9 --- /dev/null +++ b/.github/workflows/openapi-validate.yml @@ -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