feat: add initial structured-data t-string backends and release autom… #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish Python Packages | ||
|
Check failure on line 1 in .github/workflows/publish-python.yml
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| target: | ||
| description: "Package set to publish" | ||
| required: true | ||
| default: bootstrap-1 | ||
| type: choice | ||
| options: | ||
| - bootstrap-1 | ||
| - bootstrap-2 | ||
| - all | ||
| env: | ||
| PURE_PYTHON_ARTIFACT_PREFIX: python-distributions | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| build-package: | ||
| if: ${{ github.event.inputs.target == 'all' || (github.event.inputs.target == 'bootstrap-1' && (matrix.package_path == 'tstring-core' || matrix.package_path == 'json-tstring')) || (github.event.inputs.target == 'bootstrap-2' && (matrix.package_path == 'toml-tstring' || matrix.package_path == 'yaml-tstring')) }} | ||
| strategy: | ||
| matrix: | ||
| package_path: | ||
| - tstring-core | ||
| - json-tstring | ||
| - toml-tstring | ||
| - yaml-tstring | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v5 | ||
| - name: Set up uv | ||
| uses: astral-sh/setup-uv@v7 | ||
| with: | ||
| enable-cache: true | ||
| python-version: "3.14" | ||
| - name: Set up Rust | ||
| uses: dtolnay/rust-toolchain@1.94.0 | ||
| - name: Build distribution | ||
| run: uv build "${{ matrix.package_path }}" --out-dir dist | ||
| - name: Check distribution metadata | ||
| run: uvx twine check dist/* | ||
| - name: Upload distributions | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ${{ env.PURE_PYTHON_ARTIFACT_PREFIX }}-${{ matrix.package_path }} | ||
| path: dist/* | ||
| build-bindings-wheels: | ||
| if: ${{ github.event.inputs.target == 'all' || github.event.inputs.target == 'bootstrap-1' }} | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| - os: linux | ||
| runner: ubuntu-latest | ||
| target: x86_64-unknown-linux-gnu | ||
| - os: macos | ||
| runner: macos-14 | ||
| target: aarch64-apple-darwin | ||
| - os: windows | ||
| runner: windows-latest | ||
| target: x86_64-pc-windows-msvc | ||
| runs-on: ${{ matrix.runner }} | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v5 | ||
| - name: Set up uv | ||
| uses: astral-sh/setup-uv@v7 | ||
| with: | ||
| enable-cache: true | ||
| python-version: "3.14" | ||
| - name: Set up Rust | ||
| uses: dtolnay/rust-toolchain@1.94.0 | ||
| with: | ||
| targets: ${{ matrix.target }} | ||
| - name: Build bindings wheel | ||
| uses: PyO3/maturin-action@v1 | ||
| with: | ||
| target: ${{ matrix.target }} | ||
| args: --release --manifest-path rust/python-bindings/Cargo.toml --out dist | ||
| manylinux: "2_28" | ||
| sccache: "true" | ||
| - name: Check distribution metadata | ||
| run: uvx twine check dist/* | ||
| - name: Upload distributions | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: bindings-wheels-${{ matrix.os }} | ||
| path: dist/* | ||
| build-bindings-sdist: | ||
| if: ${{ github.event.inputs.target == 'all' || github.event.inputs.target == 'bootstrap-1' }} | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v5 | ||
| - name: Set up uv | ||
| uses: astral-sh/setup-uv@v7 | ||
| with: | ||
| enable-cache: true | ||
| python-version: "3.14" | ||
| - name: Set up Rust | ||
| uses: dtolnay/rust-toolchain@1.94.0 | ||
| - name: Build source distribution | ||
| run: uvx maturin sdist --manifest-path rust/python-bindings/Cargo.toml --out dist | ||
| - name: Check distribution metadata | ||
| run: uvx twine check dist/* | ||
| - name: Upload distributions | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: bindings-sdist | ||
| path: dist/* | ||
| publish-package: | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| - package_path: tstring-core | ||
| environment_name: pypi-tstring-core | ||
| - package_path: json-tstring | ||
| environment_name: pypi-json-tstring | ||
| - package_path: toml-tstring | ||
| environment_name: pypi-toml-tstring | ||
| - package_path: yaml-tstring | ||
| environment_name: pypi-yaml-tstring | ||
| runs-on: ubuntu-latest | ||
| needs: build-package | ||
| if: ${{ github.event.inputs.target == 'all' || (github.event.inputs.target == 'bootstrap-1' && (matrix.package_path == 'tstring-core' || matrix.package_path == 'json-tstring')) || (github.event.inputs.target == 'bootstrap-2' && (matrix.package_path == 'toml-tstring' || matrix.package_path == 'yaml-tstring')) }} | ||
| environment: | ||
| name: ${{ matrix.environment_name }} | ||
| permissions: | ||
| id-token: write | ||
| steps: | ||
| - name: Download distributions | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: ${{ env.PURE_PYTHON_ARTIFACT_PREFIX }}-${{ matrix.package_path }} | ||
| path: dist/ | ||
| - name: Publish to PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
| publish-bindings: | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| - build-bindings-wheels | ||
| - build-bindings-sdist | ||
| if: ${{ github.event.inputs.target == 'all' || github.event.inputs.target == 'bootstrap-1' }} | ||
| environment: | ||
| name: pypi-tstring-bindings | ||
| permissions: | ||
| id-token: write | ||
| steps: | ||
| - name: Download wheel artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| pattern: bindings-wheels-* | ||
| path: dist/ | ||
| merge-multiple: true | ||
| - name: Download source distribution | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: bindings-sdist | ||
| path: dist/ | ||
| - name: Check distribution metadata | ||
| run: uvx twine check dist/* | ||
| - name: Publish to PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||