rable 0.1.13

A Rust implementation of the Parable bash parser — complete GNU Bash 5.3-compatible parsing with Python bindings
Documentation
name: Publish

on:
  release:
    types: [published]
  workflow_dispatch:
    inputs:
      tag:
        description: "Release tag to republish (e.g. rable-v0.1.0)"
        required: true
        type: string

permissions:
  contents: write

env:
  CARGO_TERM_COLOR: always
  RELEASE_TAG: ${{ inputs.tag || github.event.release.tag_name }}

jobs:
  publish-crates:
    name: Publish to crates.io
    if: startsWith(inputs.tag || github.event.release.tag_name, 'rable-v')
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          ref: ${{ env.RELEASE_TAG }}
      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: "1.93.0"
      - uses: Swatinem/rust-cache@v2
      - name: Publish to crates.io
        run: |
          LOCAL=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.name == "rable") | .version')
          PUBLISHED=$(cargo search rable --limit 1 --color never | sed -n 's/^rable = "\([^"]*\)".*/\1/p')
          if [ "$LOCAL" = "$PUBLISHED" ]; then
            echo "::notice::rable@$LOCAL already published, skipping"
          else
            cargo publish --no-default-features
          fi
        env:
          CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

  build-wheels:
    name: Build wheels (${{ matrix.os }} / ${{ matrix.target }})
    if: startsWith(inputs.tag || github.event.release.tag_name, 'rable-v')
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64
          - os: ubuntu-latest
            target: aarch64
          - os: macos-latest
            target: x86_64
          - os: macos-latest
            target: aarch64
          - os: windows-latest
            target: x86_64
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
        with:
          ref: ${{ env.RELEASE_TAG }}
      - uses: actions/setup-python@v5
        with:
          python-version: "3.13"
      - name: Build wheels
        uses: PyO3/maturin-action@v1
        with:
          target: ${{ matrix.target }}
          args: --release --out dist --interpreter 3.13
          manylinux: auto
        env:
          PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
      - name: Upload wheels
        uses: actions/upload-artifact@v4
        with:
          name: wheels-${{ matrix.os }}-${{ matrix.target }}
          path: dist

  publish-pypi:
    name: Publish to PyPI
    runs-on: ubuntu-latest
    needs: [build-wheels]
    if: startsWith(inputs.tag || github.event.release.tag_name, 'rable-v')
    environment:
      name: pypi
      url: https://pypi.org/p/rable
    permissions:
      id-token: write
    steps:
      - uses: actions/download-artifact@v4
        with:
          pattern: wheels-*
          merge-multiple: true
          path: dist
      - uses: pypa/gh-action-pypi-publish@release/v1