build(conda.recipe): Update the recipe #24
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 Package | |
| on: | |
| push: | |
| tags: ['v*'] # Triggers on any tag push | |
| release: | |
| types: [published] # Triggers when a GitHub release is published | |
| workflow_dispatch: # Manual trigger | |
| permissions: | |
| contents: read | |
| jobs: | |
| publish: | |
| name: Build and Publish to PyPI | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write # Required for trusted publishing | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 # MANDATORY: Required for setuptools_scm to read the git tag | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.13' | |
| - name: Install build tools | |
| run: pip install --upgrade build setuptools setuptools-scm twine | |
| - name: Extract version | |
| id: get_version | |
| run: | | |
| # Get clean version from the tag or release | |
| if [[ "${{ github.event_name }}" == "release" ]]; then | |
| # For releases, get the version from the release tag | |
| TAG_NAME="${{ github.event.release.tag_name }}" | |
| else | |
| # For tags, get version from the tag | |
| TAG_NAME="${{ github.ref_name }}" | |
| fi | |
| # Remove 'v' prefix | |
| VERSION=$(echo $TAG_NAME | sed 's/^v//') | |
| # Check if this is a stable version (no rc, alpha, beta, dev, etc.) | |
| if [[ $TAG_NAME =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "IS_STABLE=true" >> $GITHUB_ENV | |
| else | |
| echo "IS_STABLE=false" >> $GITHUB_ENV | |
| fi | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Build package | |
| run: | | |
| # Force clean version | |
| export SETUPTOOLS_SCM_PRETEND_VERSION=$VERSION | |
| python -m build | |
| - name: Verify package (check dist) | |
| run: | | |
| ls -alh | |
| twine check dist/* | |
| - name: Verify wheel contents | |
| run: | | |
| unzip -l dist/*.whl | |
| # Always publish to TestPyPI for all tags and releases | |
| # TODO: Enable it later. | |
| # - name: Publish to TestPyPI | |
| # uses: pypa/gh-action-pypi-publish@release/v1 | |
| # with: | |
| # repository-url: https://test.pypi.org/legacy/ | |
| # password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
| # skip-existing: true | |
| # verbose: true | |
| # Only publish to PyPI for stable GitHub releases (no RC/alpha/beta) | |
| - name: Publish to PyPI | |
| # TODO: Enable '&& env.IS_STABLE == 'true' only publish to PyPI for stable GitHub releases (no RC/alpha/beta) | |
| if: github.event_name == 'release' #&& env.IS_STABLE == 'true' | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| user: __token__ | |
| password: ${{ secrets.PYPI_API_TOKEN }} | |
| verbose: true |