Skip to content

Commit c54fcdf

Browse files
committed
Fixed #136: Replace release workflow with wheels one
Replaced the release-only release workflow with a new wheels one that serves 2 purposes: - Build all supported wheels + sdist on every push/PR to ensure publication is not affected - Additionnaly publish those to PyPI if triggered via a release
1 parent 9ca1efb commit c54fcdf

2 files changed

Lines changed: 70 additions & 157 deletions

File tree

.github/workflows/release.yml

Lines changed: 0 additions & 157 deletions
This file was deleted.

.github/workflows/wheels.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Build and maybe upload to PyPI
2+
3+
on:
4+
push:
5+
pull_request:
6+
release:
7+
types:
8+
- published
9+
10+
env:
11+
# CIBW_ENVIRONMENT: "LIBZIM_DL_VERSION=8.2.0"
12+
CIBW_ENVIRONMENT: "LIBZIM_DL_VERSION=2023-04-14"
13+
14+
15+
jobs:
16+
build_wheels:
17+
name: Build wheels on ${{ matrix.os }}
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
matrix:
21+
os: [ubuntu-20.04, macos-11] # windows-2019
22+
23+
steps:
24+
- uses: actions/checkout@v3
25+
26+
- name: Set up QEMU
27+
if: runner.os == 'Linux'
28+
uses: docker/setup-qemu-action@v2
29+
with:
30+
platforms: all
31+
32+
- name: Build wheels
33+
uses: pypa/cibuildwheel@v2.12.1
34+
35+
- uses: actions/upload-artifact@v3
36+
with:
37+
path: ./wheelhouse/*.whl
38+
39+
build_sdist:
40+
name: Build source distribution
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@v3
44+
45+
- name: Build sdist
46+
run: pipx run build --sdist
47+
48+
- uses: actions/upload-artifact@v3
49+
with:
50+
path: dist/*.tar.gz
51+
52+
upload_pypi:
53+
needs: [build_wheels, build_sdist]
54+
runs-on: ubuntu-latest
55+
if: github.event_name == 'release' && github.event.action == 'published'
56+
steps:
57+
- uses: actions/download-artifact@v3
58+
with:
59+
# unpacks default artifact into dist/
60+
# if `name: artifact` is omitted, the action will create extra parent dir
61+
name: artifact
62+
path: dist
63+
64+
- uses: pypa/gh-action-pypi-publish@v1.5.0
65+
with:
66+
user: __token__
67+
# password: ${{ secrets.PYPI_API_TOKEN }}
68+
password: ${{ secrets.PYPI_TEST_API_TOKEN }}
69+
# uncomment for test
70+
repository_url: https://test.pypi.org/legacy/

0 commit comments

Comments
 (0)