-
Notifications
You must be signed in to change notification settings - Fork 21
64 lines (55 loc) · 1.59 KB
/
build.yml
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
name: Build struct2tensor wheels
on:
pull_request:
workflow_dispatch:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Build package
id: build-package
uses: ./.github/reusable-build
with:
python-version: ${{ matrix.python-version }}
- name: List and check wheels
shell: bash
run: |
# Pin transitive dependency on pkginfo until https://github.com/pypa/twine/issues/1070 is
# fixed
pip install twine pkginfo>=1.10.0
${{ matrix.ls || 'ls -lh' }} wheels/
twine check wheels/*
upload_to_pypi:
name: Upload to PyPI
runs-on: ubuntu-latest
if: (github.event_name == 'release' && startsWith(github.ref, 'refs/tags')) || (github.event_name == 'workflow_dispatch')
needs: [build]
environment:
name: pypi
url: https://pypi.org/p/struct2tensor/
permissions:
id-token: write
steps:
- name: Retrieve wheels
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: wheels
- name: List the build artifacts
run: |
ls -lAs wheels/
- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages_dir: wheels/