Feature: Add AstroPy Support #2861
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: | |
| pull_request: | |
| push: | |
| tags: ["v*"] | |
| concurrency: | |
| group: publish-pypi-${{ github.sha }} | |
| cancel-in-progress: false | |
| jobs: | |
| build-packages: | |
| name: Build packages | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Ensure clean tree before build | |
| run: | | |
| git diff --quiet || (git status --short && git diff && exit 1) | |
| shell: bash | |
| - name: Build package | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install wheel setuptools setuptools_scm build twine | |
| python -m build --sdist --wheel . --outdir dist | |
| shell: bash | |
| - name: Check files | |
| run: | | |
| ls -lah dist | |
| shell: bash | |
| - name: Test wheels | |
| run: | | |
| pushd dist | |
| python -m pip install ultraplot*.whl | |
| version=$(python -c "import ultraplot; print(ultraplot.__version__)") | |
| echo "Version: $version" | |
| if [[ "$version" == "0."* ]]; then | |
| echo "Version is not set correctly!" | |
| exit 1 | |
| fi | |
| python -m twine check * | |
| popd | |
| shell: bash | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: dist-${{ github.sha }}-${{ github.run_id }}-${{ github.run_number }} | |
| path: dist/* | |
| if-no-files-found: error | |
| publish-pypi-test: | |
| name: Publish to TestPyPI | |
| needs: build-packages | |
| if: github.event_name != 'pull_request' | |
| environment: | |
| name: test | |
| url: https://test.pypi.org/project/ultraplot/ | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: dist-${{ github.sha }}-${{ github.run_id }}-${{ github.run_number }} | |
| path: dist | |
| - name: Check files | |
| run: | | |
| ls -lah dist | |
| shell: bash | |
| - name: Publish to TestPyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| verbose: true | |
| skip-existing: true | |
| publish-pypi: | |
| name: Publish to PyPI | |
| needs: publish-pypi-test | |
| if: github.event_name == 'push' | |
| environment: | |
| name: prod | |
| url: https://pypi.org/project/ultraplot/ | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: dist-${{ github.sha }}-${{ github.run_id }}-${{ github.run_number }} | |
| path: dist | |
| - name: Check files | |
| run: | | |
| ls -lah dist | |
| shell: bash | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| verbose: true | |
| skip-existing: true | |
| # NOTE: Publishing this release is what triggers the Zenodo archive. Zenodo's | |
| # GitHub integration webhooks the 'release: published' event and mints a new | |
| # version under the concept DOI in CITATION.cff -- no job, token, or API call | |
| # of ours is involved. The integration only sees releases published *after* it | |
| # was enabled, so it never backfills. | |
| publish-github-release: | |
| name: Publish GitHub release | |
| needs: publish-pypi | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Create GitHub release | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| generate_release_notes: true |