Skip to content

Commit c0c3c0d

Browse files
committed
Use centralised cibuildwheel and publish_pypi
1 parent b50eee8 commit c0c3c0d

File tree

2 files changed

+8
-94
lines changed

2 files changed

+8
-94
lines changed

.github/workflows/cibuildwheel.yml

Lines changed: 5 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -9,81 +9,9 @@ on:
99
- 'prerelease-v[0-9]+.[0-9]+.[0-9]+**'
1010
jobs:
1111
build_wheels:
12-
name: Build universal wheel
13-
runs-on: ubuntu-latest
12+
uses: explosion/gha-cibuildwheel/cibuildwheel.yml@main
13+
with:
14+
pure-python: true
15+
secrets:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1417

15-
steps:
16-
- uses: actions/checkout@v4
17-
- name: Configure Python version
18-
uses: actions/setup-python@v4
19-
with:
20-
python-version: "3.11"
21-
architecture: x64
22-
- name: Build wheels
23-
run: |
24-
python -m pip install wheel
25-
python -m pip wheel . -w ./wheelhouse
26-
- uses: actions/upload-artifact@v4
27-
with:
28-
name: cibw-wheel-pure
29-
path: wheelhouse/confection-*.whl
30-
31-
build_sdist:
32-
name: Build source distribution
33-
runs-on: ubuntu-latest
34-
steps:
35-
- uses: actions/checkout@v4
36-
37-
- name: Build sdist
38-
run: pipx run build --sdist
39-
- uses: actions/upload-artifact@v4
40-
with:
41-
name: cibw-sdist
42-
path: dist/*.tar.gz
43-
create_release:
44-
needs: [build_wheels, build_sdist]
45-
runs-on: ubuntu-latest
46-
permissions:
47-
contents: write
48-
checks: write
49-
actions: read
50-
issues: read
51-
packages: write
52-
pull-requests: read
53-
repository-projects: read
54-
statuses: read
55-
steps:
56-
- name: Get the tag name and determine if it's a prerelease
57-
id: get_tag_info
58-
run: |
59-
FULL_TAG=${GITHUB_REF#refs/tags/}
60-
if [[ $FULL_TAG == release-* ]]; then
61-
TAG_NAME=${FULL_TAG#release-}
62-
IS_PRERELEASE=false
63-
elif [[ $FULL_TAG == prerelease-* ]]; then
64-
TAG_NAME=${FULL_TAG#prerelease-}
65-
IS_PRERELEASE=true
66-
else
67-
echo "Tag does not match expected patterns" >&2
68-
exit 1
69-
fi
70-
echo "FULL_TAG=$TAG_NAME" >> $GITHUB_ENV
71-
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
72-
echo "IS_PRERELEASE=$IS_PRERELEASE" >> $GITHUB_ENV
73-
- uses: actions/download-artifact@v4
74-
with:
75-
# unpacks all CIBW artifacts into dist/
76-
pattern: cibw-*
77-
path: dist
78-
merge-multiple: true
79-
- name: Create Draft Release
80-
id: create_release
81-
uses: softprops/action-gh-release@v2
82-
if: startsWith(github.ref, 'refs/tags/')
83-
env:
84-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85-
with:
86-
name: ${{ env.TAG_NAME }}
87-
draft: true
88-
prerelease: ${{ env.IS_PRERELEASE }}
89-
files: "./dist/*"

.github/workflows/publish_pypi.yml

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,6 @@ on:
1010

1111
jobs:
1212
upload_pypi:
13-
runs-on: ubuntu-latest
14-
environment:
15-
name: pypi
16-
url: https://pypi.org/p/confection
17-
permissions:
18-
id-token: write
19-
contents: read
20-
if: github.event_name == 'release' && github.event.action == 'published'
21-
# or, alternatively, upload to PyPI on every tag starting with 'v' (remove on: release above to use this)
22-
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
23-
steps:
24-
- uses: robinraju/release-downloader@v1
25-
with:
26-
tag: ${{ github.event.release.tag_name }}
27-
fileName: '*'
28-
out-file-path: 'dist'
29-
- uses: pypa/gh-action-pypi-publish@release/v1
13+
uses: explosion/gha-cibuildwheel/publish_pypi.yml@main
14+
with:
15+
pypi-package-name: 'confection'

0 commit comments

Comments
 (0)