|
| 1 | +name: Release |
| 2 | + |
| 3 | +# Triggered manually: create a tag v0.3.0 → GitHub Release → this workflow publishes to PyPI. |
| 4 | +# Tag format: v{MAJOR}.{MINOR}.{PATCH} → stable, publishes to PyPI |
| 5 | +# v{MAJOR}.{MINOR}.{PATCH}a{N} → pre-release, publishes to TestPyPI only |
| 6 | + |
| 7 | +on: |
| 8 | + push: |
| 9 | + tags: |
| 10 | + - "v[0-9]+.[0-9]+.[0-9]+*" |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: write |
| 14 | + |
| 15 | +jobs: |
| 16 | + build: |
| 17 | + name: Build ${{ matrix.package.name }} |
| 18 | + runs-on: ubuntu-latest |
| 19 | + strategy: |
| 20 | + matrix: |
| 21 | + package: |
| 22 | + - name: coordinode |
| 23 | + path: coordinode |
| 24 | + - name: langchain-coordinode |
| 25 | + path: langchain-coordinode |
| 26 | + - name: llama-index-graph-stores-coordinode |
| 27 | + path: llama-index-coordinode |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v4 |
| 30 | + with: |
| 31 | + submodules: recursive |
| 32 | + fetch-depth: 0 # hatch-vcs needs full history for tag detection |
| 33 | + |
| 34 | + - uses: actions/setup-python@v5 |
| 35 | + with: |
| 36 | + python-version: "3.11" |
| 37 | + |
| 38 | + - name: Install protoc + build tools |
| 39 | + run: | |
| 40 | + sudo apt-get update && sudo apt-get install -y protobuf-compiler |
| 41 | + pip install hatchling hatch-vcs grpcio-tools build |
| 42 | +
|
| 43 | + - name: Generate proto stubs (coordinode only) |
| 44 | + if: matrix.package.name == 'coordinode' |
| 45 | + run: make proto |
| 46 | + |
| 47 | + - name: Build wheel + sdist |
| 48 | + working-directory: ${{ matrix.package.path }} |
| 49 | + run: python -m build |
| 50 | + |
| 51 | + - name: Upload dist artifact |
| 52 | + uses: actions/upload-artifact@v4 |
| 53 | + with: |
| 54 | + name: dist-${{ matrix.package.name }} |
| 55 | + path: ${{ matrix.package.path }}/dist/ |
| 56 | + retention-days: 1 |
| 57 | + |
| 58 | + publish-testpypi: |
| 59 | + name: Publish to TestPyPI (pre-release) |
| 60 | + runs-on: ubuntu-latest |
| 61 | + needs: build |
| 62 | + if: contains(github.ref_name, 'a') || contains(github.ref_name, 'b') || contains(github.ref_name, 'rc') |
| 63 | + environment: testpypi |
| 64 | + permissions: |
| 65 | + id-token: write |
| 66 | + strategy: |
| 67 | + matrix: |
| 68 | + package: |
| 69 | + - coordinode |
| 70 | + - langchain-coordinode |
| 71 | + - llama-index-graph-stores-coordinode |
| 72 | + steps: |
| 73 | + - uses: actions/download-artifact@v4 |
| 74 | + with: |
| 75 | + name: dist-${{ matrix.package }} |
| 76 | + path: dist/ |
| 77 | + |
| 78 | + - uses: pypa/gh-action-pypi-publish@release/v1 |
| 79 | + with: |
| 80 | + repository-url: https://test.pypi.org/legacy/ |
| 81 | + packages-dir: dist/ |
| 82 | + |
| 83 | + publish-pypi: |
| 84 | + name: Publish to PyPI (stable) |
| 85 | + runs-on: ubuntu-latest |
| 86 | + needs: build |
| 87 | + if: "!contains(github.ref_name, 'a') && !contains(github.ref_name, 'b') && !contains(github.ref_name, 'rc')" |
| 88 | + environment: pypi |
| 89 | + permissions: |
| 90 | + id-token: write |
| 91 | + strategy: |
| 92 | + matrix: |
| 93 | + package: |
| 94 | + - coordinode |
| 95 | + - langchain-coordinode |
| 96 | + - llama-index-graph-stores-coordinode |
| 97 | + steps: |
| 98 | + - uses: actions/download-artifact@v4 |
| 99 | + with: |
| 100 | + name: dist-${{ matrix.package }} |
| 101 | + path: dist/ |
| 102 | + |
| 103 | + - uses: pypa/gh-action-pypi-publish@release/v1 |
| 104 | + with: |
| 105 | + packages-dir: dist/ |
| 106 | + |
| 107 | + github-release: |
| 108 | + name: Create GitHub Release |
| 109 | + runs-on: ubuntu-latest |
| 110 | + needs: build |
| 111 | + permissions: |
| 112 | + contents: write |
| 113 | + steps: |
| 114 | + - uses: actions/download-artifact@v4 |
| 115 | + with: |
| 116 | + pattern: dist-* |
| 117 | + merge-multiple: true |
| 118 | + path: dist/ |
| 119 | + |
| 120 | + - uses: softprops/action-gh-release@v2 |
| 121 | + with: |
| 122 | + prerelease: ${{ contains(github.ref_name, 'a') || contains(github.ref_name, 'b') || contains(github.ref_name, 'rc') }} |
| 123 | + generate_release_notes: true |
| 124 | + files: dist/* |
0 commit comments