Merge pull request #7 from AIBlockOfficial/ci/publish-pypi #7
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: | |
| push: | |
| branches: [ "main" ] | |
| concurrency: | |
| group: publish-pypi-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install uv | |
| run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
| - name: Create virtual environment | |
| run: ~/.local/bin/uv venv | |
| - name: Install dependencies | |
| run: | | |
| ~/.local/bin/uv pip install -r requirements.txt -r requirements-test.txt | |
| - name: Run tests | |
| env: | |
| AIBLOCK_PASSPHRASE: test | |
| AIBLOCK_STORAGE_HOST: https://storage.aiblock.dev | |
| AIBLOCK_MEMPOOL_HOST: https://mempool.aiblock.dev | |
| AIBLOCK_VALENCE_HOST: https://valence.aiblock.dev | |
| run: ~/.local/bin/uv run pytest -q | |
| build-and-publish: | |
| name: Build and publish | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install build backend | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install build | |
| - name: Build sdist and wheel | |
| run: python -m build | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| password: ${{ secrets.PYPI_API_TOKEN }} | |
| skip-existing: true | |
| needs: [test] | |