From 64a402320e7f10aca1d5a4d5e504181fa9812bc2 Mon Sep 17 00:00:00 2001 From: Leon Haffmans Date: Mon, 9 Oct 2023 14:35:38 +0200 Subject: [PATCH] Add release workflow step to rebuild JSON schemas --- .github/workflows/python-publish.yml | 33 ++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index fc72aaddb..0d0e4d1be 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -29,7 +29,36 @@ jobs: - name: Run the Tests run: | tox -e tests - + generate: + name: Generate JSON-Schemas + runs-on: ubuntu-latest + needs: tests + steps: + - name: Check out Git repository + uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install tox + run: | + python -m pip install --upgrade pip + pip install tox + - name: Build JSON Schemas + run: tox -e generate_json_schemas + - name: Push schemas to BO4E-Schemas repo + uses: cpina/github-action-push-to-another-repository@v1.7.2 + env: + API_TOKEN_GITHUB: ${{ secrets.BO4E_PYTHON_GENERATE_SCHEMAS }} # this token expires on 2024-10-09 + # token with repo scope + # https://github.com/Hochfrequenz/BO4E-python/settings/secrets/actions/BO4E_PYTHON_GENERATE_SCHEMAS + with: + source-directory: "json_schemas" + target-directory: "src/bo4e_schemas" + destination-github-username: "Hochfrequenz" + destination-repository-name: "BO4E-Schemas" + user-email: bo4e-schemas@hochfrequenz.de + target-branch: main build-n-publish: name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI runs-on: ubuntu-latest @@ -38,7 +67,7 @@ jobs: permissions: # IMPORTANT: this permission is mandatory for trusted publishing id-token: write - needs: tests + needs: [tests, generate] steps: - uses: actions/checkout@v4 - name: Set up Python