Skip to content

Merge pull request #17 from drlukeparry/dev #2

Merge pull request #17 from drlukeparry/dev

Merge pull request #17 from drlukeparry/dev #2

Workflow file for this run

# Github Actions script to produce binary wheels.
#
# * One build to create all wheels (cross-platform universal wheel).
# * One build (with matrix) test the wheels on a selection of platforms.
# * One build to publish the wheels on GitHub and Pypi.
name: CD
on:
workflow_dispatch:
push:
tags:
- 'v*'
pull_request:
branches:
- main
jobs:
build-wheels:
name: Build all wheels
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dev dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools flit build twine hatchling
- name: Create source distribution
run: |
python -m build -n -s
- name: Build wheel
run: |
python -m build -n -w
- name: Twine check
run: |
twine check dist/*
- name: Upload distributions
uses: actions/upload-artifact@v4
with:
path: dist
name: all_wheels
publish:
name: Publish to Github and Pypi
runs-on: ubuntu-latest
needs: [build-wheels]
if: success() && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Download assets
uses: actions/download-artifact@v4
with:
path: dist
- name: Flatten dist dir
run: |
find dist -mindepth 2 -type f -exec mv -f '{}' dist/ ';'
rm -rf dist/*/
- name: Set version from git ref
run: echo "PYCCX_PY_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: Upload Release Assets
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.PYCCX_PY_VERSION }}
name: ${{ env.PYCCX_PY_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
files: |
dist/*.tar.gz
dist/*.whl
body: |
Autogenerated wheels for PyCCX
draft: false
prerelease: false
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}