-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update wheels and sdits building and distribution
- Loading branch information
1 parent
6b52e73
commit 03ec4b8
Showing
1 changed file
with
91 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,16 +56,43 @@ jobs: | |
name: ${{ matrix.python }} | ||
fail_ci_if_error: false | ||
|
||
build_wheels: | ||
needs: [tests] | ||
source_distribution: | ||
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' | ||
name: ${{ matrix.os }} | ||
needs: | ||
- tests | ||
name: Build source distribution | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v5 | ||
name: Install Python | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install build | ||
- name: Build a source tarball | ||
run: python -m build | ||
|
||
- name: Store the distribution packages | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: dist/*.tar.gz | ||
|
||
wheels: | ||
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' | ||
needs: | ||
- tests | ||
name: Build wheels for ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, windows-2019, macos-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
|
@@ -86,45 +113,74 @@ jobs: | |
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
path: ./wheelhouse | ||
overwrite: true | ||
name: wheels-${{ matrix.os }}-${{ strategy.job-index }} | ||
path: ./wheelhouse/*.whl | ||
|
||
build_sdist: | ||
needs: [tests] | ||
publish-to-pypi: | ||
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' | ||
name: Build source distribution | ||
needs: | ||
- source_distribution | ||
- wheels | ||
name: Upload Source and Wheels to Pypi | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/color-operations | ||
permissions: | ||
id-token: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v5 | ||
name: Install Python | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v4 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install numpy Cython | ||
- name: Build sdist | ||
run: python setup.py sdist | ||
name: python-package-distributions | ||
path: dist/ | ||
|
||
- name: Publish distribution 📦 to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
||
github-release: | ||
name: >- | ||
Sign the Python 🐍 distribution 📦 with Sigstore | ||
and upload them to GitHub Release | ||
needs: | ||
- publish-to-pypi | ||
runs-on: ubuntu-latest | ||
|
||
- uses: actions/upload-artifact@v4 | ||
with: | ||
path: dist/*.tar.gz | ||
overwrite: true | ||
permissions: | ||
contents: write | ||
id-token: write | ||
|
||
upload_pypi: | ||
needs: [build_wheels, build_sdist] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: artifact | ||
path: dist | ||
name: python-package-distributions | ||
path: dist/ | ||
|
||
- uses: pypa/gh-action-pypi-publish@release/v1 | ||
- name: Sign the dists with Sigstore | ||
uses: sigstore/[email protected] | ||
with: | ||
user: ${{ secrets.PYPI_USERNAME }} | ||
password: ${{ secrets.PYPI_PASSWORD }} | ||
# To test: repository_url: https://test.pypi.org/legacy/ | ||
inputs: >- | ||
./dist/*.tar.gz | ||
./dist/*.whl | ||
- name: Create GitHub Release | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
run: >- | ||
gh release create | ||
'${{ github.ref_name }}' | ||
--repo '${{ github.repository }}' | ||
--notes "" | ||
- name: Upload artifact signatures to GitHub Release | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
# Upload to GitHub Release using the `gh` CLI. | ||
# `dist/` contains the built packages, and the | ||
# sigstore-produced signatures and certificates. | ||
run: >- | ||
gh release upload | ||
'${{ github.ref_name }}' dist/** | ||
--repo '${{ github.repository }}' | ||