Release (PyPI) #37
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: Release (PyPI) | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| id-token: write # Needed for PyPI Trusted Publishing | |
| env: | |
| RECIPE_DIR: conda-recipe | |
| ANACONDA_USER: metorial | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v3 | |
| with: | |
| version: latest | |
| - name: Install workspace dependencies | |
| run: uv sync --dev | |
| - name: Run tests (skip if none) | |
| run: | | |
| set -e | |
| if ls tests/*.py 2>/dev/null; then | |
| uv run pytest -q | |
| else | |
| echo "No tests found; skipping pytest." | |
| fi | |
| build_publish_pypi: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| # environment: pypi # removed for simplicity | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| package: | |
| - packages/metorial-util-endpoint | |
| - packages/metorial-generated | |
| - packages/metorial-core | |
| - packages/metorial-mcp-session | |
| - packages/metorial-openai | |
| - packages/metorial-openai-compatible | |
| - packages/metorial-anthropic | |
| - packages/metorial-google | |
| - packages/metorial-mistral | |
| - packages/metorial-xai | |
| - packages/metorial-deepseek | |
| - packages/metorial-togetherai | |
| - packages/metorial | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v3 | |
| with: | |
| version: latest | |
| - name: Build package | |
| working-directory: ${{ matrix.package }} | |
| run: | | |
| # Copy shared files if they don't exist | |
| # Each package should have its own README.md | |
| if [ ! -f "README.md" ]; then | |
| cp ../../README.md . || echo "No shared README.md found" | |
| fi | |
| cp ../../LICENSE . || echo "No LICENSE found" | |
| # Build the package - force output to local dist directory | |
| uv build --out-dir dist | |
| - name: Publish to PyPI (OIDC) | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: ${{ matrix.package }}/dist | |
| skip-existing: true | |
| verbose: true | |
| timeout-minutes: 10 | |
| # conda: | |
| # needs: test # or [build_publish_pypi] if you require PyPI first | |
| # runs-on: ubuntu-latest | |
| # env: | |
| # GIT_TAG: ${{ github.ref_name }} # e.g. v1.0.0 | |
| # steps: | |
| # - uses: actions/checkout@v4 | |
| # | |
| # - name: Set up Miniconda | |
| # uses: conda-incubator/setup-miniconda@v3 | |
| # with: | |
| # auto-update-conda: true | |
| # activate-environment: build | |
| # python-version: '3.11' | |
| # channels: conda-forge,defaults | |
| # channel-priority: strict | |
| # mamba-version: '*' | |
| # | |
| # - name: Install build tools | |
| # shell: bash -l {0} | |
| # run: mamba install -y conda-build boa anaconda-client | |
| # | |
| # - name: Export build vars | |
| # run: echo "BUILD_NUMBER=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV | |
| # | |
| # - name: Build noarch Conda package | |
| # shell: bash -l {0} | |
| # run: conda mambabuild "$RECIPE_DIR" --output-folder conda_artifacts | |
| # | |
| # - name: Upload to Anaconda.org (dev) | |
| # if: github.event.release.prerelease == true | |
| # shell: bash -l {0} | |
| # env: | |
| # BINSTAR_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }} | |
| # run: | | |
| # anaconda upload $(find conda_artifacts -name '*.tar.bz2') \ | |
| # --user "$ANACONDA_USER" \ | |
| # --label dev \ | |
| # --skip-existing | |
| # | |
| # - name: Upload to Anaconda.org (main) | |
| # if: github.event.release.prerelease == false | |
| # shell: bash -l {0} | |
| # env: | |
| # BINSTAR_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }} | |
| # run: | | |
| # anaconda upload $(find conda_artifacts -name '*.tar.bz2') \ | |
| # --user "$ANACONDA_USER" \ | |
| # --label main \ | |
| # --skip-existing |