lenskit/lkpy

View on GitHub
.github/workflows/package.yml

Summary

Maintainability
Test Coverage
name: Distribution

on:
  push:
    branches:
      - main
  pull_request:
  release:
    types: [published]

jobs:
  dist:
    name: Build Packages
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Fetch Git tags
        run: git fetch --tags

      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: "3.10"

      - name: Install Python deps
        run: pip install -U build

      - name: Build distribution
        run: |
          python -m build -o dist lenskit
          python -m build -o dist lenskit-funksvd
          python -m build -o dist lenskit-implicit
          python -m build -o dist lenskit-hpf

      - name: Save archive
        uses: actions/upload-artifact@v4
        with:
          name: pypi-pkgs
          path: dist

      - name: List dist dir
        run: ls -R dist

  pypi-publish:
    name: Publish to PyPI
    runs-on: ubuntu-latest
    needs: [dist]
    if: github.event_name == 'release'

    environment: release
    permissions:
      id-token: write

    steps:
      - name: Fetch compiled package distributions
        uses: actions/download-artifact@v4
        with:
          name: pypi-pkgs
          path: dist

      - name: Publish package distributions to PyPI
        uses: pypa/gh-action-pypi-publish@release/v1