Skip to content

Add support for Python 3.12 (#55) #14

Add support for Python 3.12 (#55)

Add support for Python 3.12 (#55) #14

Workflow file for this run

name: Publish
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
build:
runs-on: 'ubuntu-latest'
environment: release
permissions:
contents: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
strategy:
matrix:
platform:
- macosx_10_4_x86_64
- macosx_11_0_arm64
- manylinux_2_17_x86_64
- manylinux_2_17_armv7l
- manylinux_2_17_aarch64
- win_amd64
steps:
- uses: actions/checkout@v3
# Need more than a shallow clone to get version from tags
with:
fetch-depth: 2
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build virtualenv
- name: Build wheels
run: python -m build --wheel --outdir wheelhouse
env:
PLAT_NAME: ${{ matrix.platform }}
- name: Build source distribution
run: python -m build --sdist --outdir wheelhouse
if: matrix.platform == 'manylinux_2_17_x86_64'
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*
deploy:
runs-on: 'ubuntu-latest'
needs: [ build ]
steps:
- name: Clone repository
uses: actions/checkout@v3
# Need depth to get diff for changelog
with:
fetch-depth: 1
- name: Download dist artifacts
uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
# PyPI package
- name: Publish Python package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: wheelhouse/
# Documentation
- name: Install doc dependencies
run: |
pip install -r requirements.txt
pip install -r docs/requirements.txt
- name: Build documentation
run: |
python -m sphinx docs/ docs/_build/ -b html
- name: Deploy documentation to Github pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build
# Github release
- name: Read CHANGELOG
id: changelog
run: |
# Get bullet points from last CHANGELOG entry
CHANGELOG=$(git diff -U0 HEAD^ HEAD | grep '^[+][\* ]' | sed 's/\+//')
echo "Got changelog: $CHANGELOG"
# Support for multiline, see
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
{
echo 'body<<EOF'
echo "$CHANGELOG"
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Create release on Github
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
name: Release ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.body }}