Switch to unified view

a b/.github/workflows/release.yml
1
# This workflow will upload a Python Package using Twine when a release is created
2
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3
4
# This workflow uses actions that are not certified by GitHub.
5
# They are provided by a third-party and are governed by
6
# separate terms of service, privacy policy, and support
7
# documentation.
8
9
name: Upload Python Package
10
11
on:
12
  workflow_dispatch:
13
  release:
14
    types: [published]
15
16
env:
17
  # UV_INDEX_STRATEGY: "unsafe-first-match"
18
  # UV_EXTRA_INDEX_URL: "https://download.pytorch.org/whl/cpu"
19
  PIP_EXTRA_INDEX_URL: "https://download.pytorch.org/whl/cpu"
20
21
jobs:
22
  build_wheels:
23
    name: Build wheels on ${{ matrix.os }}/${{ matrix.arch || '*' }}
24
    runs-on: ${{ matrix.os }}
25
    strategy:
26
      matrix:
27
        os: [ubuntu-22.04, windows-latest, macos-latest]
28
29
    steps:
30
      - uses: actions/checkout@v4
31
32
      - name: Build wheels
33
        uses: pypa/cibuildwheel@v2.21.3
34
        env:
35
          CIBW_ARCHS_MACOS: "x86_64 arm64"
36
          CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://download.pytorch.org/whl/cpu
37
38
      - uses: actions/upload-artifact@v4
39
        with:
40
          name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
41
          path: ./wheelhouse/*.whl
42
43
  build_sdist:
44
    name: Build source distribution
45
    runs-on: ubuntu-22.04
46
    steps:
47
      - uses: actions/checkout@v2
48
49
      - name: Build sdist
50
        run: pipx run build --sdist
51
52
      - uses: actions/upload-artifact@v4
53
        with:
54
          name: cibw-sdist
55
          path: dist/*.tar.gz
56
57
  PyPI:
58
    name: Upload to PyPI
59
60
    needs: [build_wheels, build_sdist]
61
    runs-on: ubuntu-22.04
62
63
    steps:
64
    - uses: actions/download-artifact@v4
65
      with:
66
        pattern: cibw-*
67
        path: dist
68
        merge-multiple: true
69
    - name: Publish package
70
      uses: pypa/gh-action-pypi-publish@v1.5.0
71
      with:
72
        user: __token__
73
        password: ${{ secrets.PYPI_API_TOKEN }}
74
75
        # password: ${{ secrets.TEST_PYPI_API_TOKEN }}
76
        # repository_url: https://test.pypi.org/legacy/
77
78
  Documentation:
79
    runs-on: ubuntu-22.04
80
    steps:
81
    - uses: actions/checkout@v3
82
83
    - uses: actions/setup-python@v4
84
      with:
85
        python-version: "3.9"
86
        cache: 'pip'
87
88
    - name: Install dependencies
89
      run: |
90
        python -m pip install --upgrade pip
91
        pip install '.[docs]'
92
93
    - name: Set up Git
94
      run: |
95
        git config user.name ${{ github.actor }}
96
        git config user.email ${{ github.actor }}@users.noreply.github.com
97
98
    - name: Build documentation
99
      run: |
100
        git fetch origin gh-pages
101
        mike deploy --push --no-redirect --update-aliases $GITHUB_REF_NAME latest