Debian Codegraph @

.github/workflows/release-pypi.yml

raw symbols SCIP
1 name: Build and upload python package to PyPI
2
3 # PyPI uploads are irreversible (a version can be yanked but its file names
4 # can never be reused), so this workflow runs only when the GitHub release is
5 # published, not when the tag is pushed and the release is still a draft.
6 on:
7 release:
8 types: [published]
9 workflow_dispatch:
10
11 jobs:
12 release-pypi:
13 permissions:
14 contents: read
15 strategy:
16 fail-fast: false
17 matrix:
18 os: [ubuntu-latest, ubuntu-22.04-arm, macos-15-intel, macos-15, windows-2022]
19 runs-on: ${{ matrix.os }}
20
21 steps:
22 - uses: actions/checkout@v5
23 with:
24 fetch-depth: 0
25 - name: Compute version
26 id: version
27 shell: bash
28 run: |
29 VERSION=$(bash scripts/compute-version.sh)
30 echo "VERSION=$VERSION" >> "$GITHUB_ENV"
31 echo "version=$VERSION" >> "$GITHUB_OUTPUT"
32 echo "Computed version: $VERSION"
33
34 - name: Set up Python
35 uses: actions/setup-python@v6
36 with:
37 python-version: "3.12"
38
39 - name: Build package and upload (Linux)
40 if: runner.os == 'Linux'
41 run: bash release-pypi-linux.sh
42 env:
43 TWINE_USERNAME: __token__
44 TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
45
46 - name: Build package and upload (macOS)
47 if: runner.os == 'macOS'
48 run: bash release-pypi-macos.sh
49 env:
50 TWINE_USERNAME: __token__
51 TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
52
53 - name: Build package and upload (Windows)
54 if: runner.os == 'Windows'
55 run: ./release-pypi-windows.cmd
56 env:
57 TWINE_USERNAME: __token__
58 TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}