Skip to content

Build(deps): Bump pypa/gh-action-pypi-publish from 1.12.2 to 1.12.3 #410

Build(deps): Bump pypa/gh-action-pypi-publish from 1.12.2 to 1.12.3

Build(deps): Bump pypa/gh-action-pypi-publish from 1.12.2 to 1.12.3 #410

Workflow file for this run

---
name: Build and upload to PyPI
concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }}
cancel-in-progress: true
# Only build on published releases
on:
release:
types:
- published
# Also allow running this action on PRs if requested by applying the
# "Run cibuildwheel" label.
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
permissions:
contents: read
jobs:
build_sdist:
if: >-
github.event_name == 'release' ||
(github.event_name == 'pull_request' && (
(
github.event.action == 'labeled' &&
github.event.label.name == 'CI: build wheels'
) ||
contains(github.event.pull_request.labels.*.name,
'CI: build wheels')
)
)
name: Build source distribution
runs-on: ubuntu-latest
outputs:
SDIST_NAME: ${{ steps.sdist.outputs.SDIST_NAME }}
steps:
- uses: actions/checkout@v4
with:
# We need the full history to generate the proper version number
fetch-depth: 0
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.11'
- name: Install dependencies
run: python -m pip install build twine
- name: Build sdist
id: sdist
run: |
python -m build --sdist
# Get the name of the build sdist file for later use
echo "SDIST_NAME=$(ls -1 dist)" >> $GITHUB_OUTPUT
- name: Check README rendering for PyPI
run: twine check dist/*
- name: Upload sdist result
uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
if-no-files-found: error
build_wheels:
needs: build_sdist
name: Build wheels on ${{ matrix.os }} for ${{ matrix.cibw_archs }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
cibw_archs: "x86_64"
- os: windows-2019
cibw_archs: "auto64"
- os: macos-latest
cibw_archs: "x86_64"
- os: macos-latest
cibw_archs: "arm64"
defaults:
run:
shell: bash
steps:
- name: Download sdist
uses: actions/download-artifact@v4
with:
name: cibw-sdist
path: dist
- name: Build wheels for CPython
uses: pypa/cibuildwheel@ee63bf16da6cddfb925f542f2c7b59ad50e93969 # v2.22.0
with:
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }}
env:
CIBW_BUILD: "cp310-* cp311-* cp312-* cp313-*"
# Skip 32 bit builds and musllinux due to lack of numpy wheels
CIBW_SKIP: "*-win32 *_i686 *-musllinux*"
CIBW_ARCHS: ${{ matrix.cibw_archs }}
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ matrix.cibw_archs }}
path: ./wheelhouse/*.whl
if-no-files-found: error
publish:
name: Publish to PyPI
# Only publish on releases
if: github.event_name == 'release'
needs: [build_wheels, build_sdist]
environment:
name: PyPI
url: https://pypi.org/project/cartopy
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
runs-on: ubuntu-latest
steps:
- name: Download wheels
uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true
- name: Publish Package
uses: pypa/[email protected]