-
Notifications
You must be signed in to change notification settings - Fork 7
63 lines (56 loc) · 2.05 KB
/
python-wheels.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
name: Build and publish python wheels
on:
workflow_dispatch:
push:
branches:
- main
tags:
- '**'
jobs:
build-publish:
name: Build and publish wheels
runs-on: ubuntu-latest
strategy:
matrix:
package:
- 'hugr-py'
steps:
- uses: actions/checkout@v4
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Install poetry
run: pipx install poetry
- name: Set up Python '3.10'
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: "poetry"
- name: Build sdist and wheels
run: |
cd ${{ matrix.package }}
poetry build -o ../dist
- name: Upload the built packages as artifacts
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.package }}-sdist
path: |
dist/*.tar.gz
dist/*.whl
- name: Publish to test instance of PyPI (dry-run)
if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref_type == 'branch' ) }}
run: |
echo "Doing a dry-run publish to test-pypi..."
echo "Based on the following workflow variables, this is not a hugr-py version tag push:"
echo " - event_name: ${{ github.event_name }}"
echo " - ref_type: ${{ github.ref_type }}"
echo " - ref: ${{ github.ref }}"
cd ${{ matrix.package }}
poetry config repositories.test-pypi https://test.pypi.org/legacy/
poetry config pypi-token.test-pypi ${{ secrets.PYPI_TEST_PUBLISH }}
poetry publish -r test-pypi --dist-dir ../dist --skip-existing --dry-run
- name: Publish to PyPI
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' && startsWith(github.ref, format('refs/tags/{0}-v', matrix.package)) }}
run: |
cd ${{ matrix.package }}
poetry config pypi-token.pypi ${{ secrets.PYPI_PUBLISH }}
poetry publish --dist-dir ../dist --skip-existing