0.3.0 #54
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: PyPI release | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| branches: [main] | |
| push: | |
| branches: [main] | |
| release: | |
| types: [published] | |
| permissions: {} | |
| jobs: | |
| build: | |
| name: Build source distribution | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v8.2.0 | |
| - name: Build the sdist and the wheel | |
| run: uv build | |
| - name: Check the sdist installs and imports | |
| run: | | |
| uv venv venv-sdist | |
| uv pip install --python venv-sdist/bin/python dist/tidydraws*.tar.gz | |
| echo "Checking import and version number (on release)" | |
| venv-sdist/bin/python -c "import tidydraws; assert tidydraws.__version__ == '${REF_NAME}' if '${REF_TYPE}' == 'tag' else tidydraws.__version__; print(tidydraws.__version__)" | |
| env: | |
| REF_NAME: ${{ github.ref_name }} | |
| REF_TYPE: ${{ github.ref_type }} | |
| - name: Check the bdist installs and imports | |
| run: | | |
| uv venv venv-bdist | |
| uv pip install --python venv-bdist/bin/python dist/tidydraws*.whl | |
| echo "Checking import and version number (on release)" | |
| venv-bdist/bin/python -c "import tidydraws; assert tidydraws.__version__ == '${REF_NAME}' if '${REF_TYPE}' == 'tag' else tidydraws.__version__; print(tidydraws.__version__)" | |
| env: | |
| REF_NAME: ${{ github.ref_name }} | |
| REF_TYPE: ${{ github.ref_type }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: artifact | |
| path: dist/* | |
| test-publish: | |
| name: Upload to Test PyPI | |
| permissions: | |
| id-token: write | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: artifact | |
| path: dist | |
| - uses: pypa/gh-action-pypi-publish@v1.14.0 | |
| with: | |
| skip_existing: true | |
| repository_url: https://test.pypi.org/legacy/ | |
| - name: Test pip install from test.pypi | |
| run: | | |
| sleep 5s | |
| python -m venv venv-test-pypi | |
| venv-test-pypi/bin/python -m pip install \ | |
| --index-url https://test.pypi.org/simple/ \ | |
| --extra-index-url https://pypi.org/simple \ | |
| tidydraws | |
| echo "Checking import and version number" | |
| venv-test-pypi/bin/python -c "import tidydraws; print(tidydraws.__version__)" | |
| publish: | |
| environment: release | |
| permissions: | |
| id-token: write | |
| name: Upload release to PyPI | |
| needs: [build, test-publish] | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: artifact | |
| path: dist | |
| - uses: pypa/gh-action-pypi-publish@v1.14.0 |