File: publish-to-pypi.yml

package info (click to toggle)
python-bcj 1.0.7%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 264 kB
  • sloc: ansic: 1,503; python: 341; makefile: 4
file content (88 lines) | stat: -rw-r--r-- 2,854 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Publish Python 🐍 distributions πŸ“¦ to PyPI and TestPyPI

on:
  push:
    branches:
      - releases/*
    tags:
      - v*

jobs:
  build_wheels:
    name: Build wheels on ${{ matrix.platform }}
    runs-on: ${{ matrix.platform }}
    strategy:
      matrix:
        platform: [ubuntu-latest, macos-latest, windows-latest, ubuntu-24.04-arm, windows-11-arm]
    env:
      CIBW_ARCHS_LINUX: "native"
      CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
      # Include latest Python beta
      CIBW_PRERELEASE_PYTHONS: True
    steps:
      - name: Checkout πŸ›ŽοΈ
        uses: actions/checkout@v4
        with:
          fetch-depth: 20
      - name: Fetch release tags
        run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
      - name: Set up Python 🐍
        uses: actions/setup-python@v6
        with:
          python-version: 3.13
      - name: Install cibuildwheel & build wheels
        run: |
          python -m pip install -U pip
          python -m pip install -U cibuildwheel
          python -m cibuildwheel --output-dir wheelhouse
      - name: Upload wheels
        uses: actions/upload-artifact@v4
        with:
          name: artifact-${{ matrix.platform }}
          path: wheelhouse/*.whl

  build_source_dist:
    name: Build source dist
    runs-on: ubuntu-latest
    steps:
      - name: Checkout πŸ›ŽοΈ
        uses: actions/checkout@v4
        with:
          fetch-depth: 20
      - name: Fetch release tags
        run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
      - name: Set up Python 🐍
        uses: actions/setup-python@v6
        with:
          python-version: 3.13
      - name: Build source distribution & wheels🎑
        run: |
          python -m pip install -U pip setuptools setuptools_scm[toml] build
          python -m build --sdist
      - name: Upload source distribution
        uses: actions/upload-artifact@v4
        with:
          name: artifact-source
          path: dist/*.tar.gz

  pypi-publish:
    name: publish Python 🐍 distributions πŸ“¦ to PyPI and TestPyPI
    runs-on: ubuntu-latest
    needs: [build_wheels, build_source_dist]
    environment: pypi
    permissions:
      id-token: write
    steps:
      - name: download dist artifacts
        uses: actions/download-artifact@v4
        with:
          path: dist
          merge-multiple: true
      - name: Publish distribution πŸ“¦ to Test PyPI
        if: ${{ startsWith(github.event.ref, 'refs/heads/releases') }}
        uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc  # release/v1.12.4
        with:
          repository-url: https://test.pypi.org/legacy/
      - name: Publish distribution πŸ“¦ to PyPI
        if: startsWith(github.event.ref, 'refs/tags')
        uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # release/v1.12.4