fix: route delete_namespace to /admin-api/namespaces/{id} (#37) #114
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: Build and Publish Source Distribution | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| build-source: | |
| name: Build source distribution | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.13' | |
| - name: Install Rust toolchain | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| override: true | |
| - name: Install build tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install maturin build twine | |
| - name: Build source distribution | |
| run: | | |
| # Build source distribution using maturin | |
| maturin build --sdist --out dist | |
| # Also build using standard Python build tools as backup | |
| python -m build --sdist --outdir dist | |
| - name: Upload source artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: source-distribution | |
| path: dist/*.tar.gz | |
| retention-days: 1 | |
| check-version: | |
| name: Check if version was bumped | |
| runs-on: ubuntu-latest | |
| needs: [build-source] | |
| if: github.ref == 'refs/heads/master' | |
| permissions: | |
| contents: write | |
| actions: write | |
| outputs: | |
| version-bumped: ${{ steps.check.outputs.bumped }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - name: Check version changes | |
| id: check | |
| run: | | |
| # Get current version from pyproject.toml | |
| CURRENT_VERSION=$(grep '^version = ' pyproject.toml | cut -d'"' -f2) | |
| echo "Current version: $CURRENT_VERSION" | |
| # Get previous version from git history | |
| PREVIOUS_VERSION=$(git show HEAD~1:pyproject.toml | grep '^version = ' | cut -d'"' -f2 || echo "0.0.0") | |
| echo "Previous version: $PREVIOUS_VERSION" | |
| # Check if version was bumped | |
| if [ "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ]; then | |
| echo "Version bumped from $PREVIOUS_VERSION to $CURRENT_VERSION" | |
| echo "bumped=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "No version change detected" | |
| echo "bumped=false" >> $GITHUB_OUTPUT | |
| fi | |
| publish-pypi: | |
| name: Publish to PyPI | |
| runs-on: ubuntu-latest | |
| needs: [build-source, check-version] | |
| if: github.ref == 'refs/heads/master' && needs.check-version.outputs.version-bumped == 'true' | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - name: Download source artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: source-distribution | |
| path: dist/ | |
| - name: Verify source distribution | |
| run: | | |
| echo "Source distributions found:" | |
| ls -la dist/ | |
| echo "Total source distribution count: $(ls dist/*.tar.gz 2>/dev/null | wc -l)" | |
| # Verify the source distribution | |
| for file in dist/*.tar.gz; do | |
| echo "Checking $file" | |
| tar -tzf "$file" | head -10 | |
| done | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| password: ${{ secrets.PYPI_API_TOKEN }} | |
| packages-dir: dist/ |