Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: JSON Schema

# Attach the JSON Schemas for the model files to each published release, so that they have a
# versioned URL for editors and other tools. The upload replaces assets of the same name, so a
# re-run of the job on a release is safe.
on:
release:
types: [ published ]

permissions:
contents: write

env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always

jobs:
schema:
name: Export and upload the JSON Schemas
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.release.tag_name }}
submodules: true
- uses: dtolnay/rust-toolchain@stable
- uses: swatinem/rust-cache@v2
- name: "Set up Python"
uses: actions/setup-python@v7
with:
python-version-file: "pyproject.toml"
- name: Export the schemas
run: |
cargo run --locked --release -p pywr-cli -- export-schema pywr-v2.schema.json
cargo run --locked --release -p pywr-cli -- export-schema pywr.schema.json --union
- name: Upload the schemas to the release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.event.release.tag_name }}
run: gh release upload --clobber "$TAG" pywr-v2.schema.json pywr.schema.json
Loading
Loading