v0.7.0 #3
Workflow file for this run
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 to PyPI | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| inputs: | |
| publish_to: | |
| description: 'Publish target' | |
| required: true | |
| default: 'testpypi' | |
| type: choice | |
| options: | |
| - testpypi | |
| - pypi | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| build-and-publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Update version from release tag | |
| if: github.event_name == 'release' | |
| run: | | |
| VERSION="${{ github.ref_name }}" | |
| VERSION="${VERSION#v}" | |
| echo "Updating pyproject.toml version to $VERSION" | |
| sed -i "s/^version = \".*\"/version = \"$VERSION\"/" pyproject.toml | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: 'npm' | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install Python build tools | |
| run: pip install build twine | |
| - name: Install Python dependencies | |
| run: | | |
| pip install -r scripts/config/requirements-pyodide.txt | |
| pip install -r scripts/config/requirements-build.txt | |
| - name: Install Node dependencies | |
| run: npm ci | |
| - name: Extract blocks from PathSim | |
| run: npm run extract | |
| - name: Build package (frontend + wheel) | |
| run: python scripts/build_package.py | |
| - name: Check distribution | |
| run: twine check dist/* | |
| - name: Publish to Test PyPI | |
| if: github.event_name == 'workflow_dispatch' && inputs.publish_to == 'testpypi' | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| - name: Publish to PyPI | |
| if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.publish_to == 'pypi') | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ |