Skip to content

Build and publish wheel to PYPI #18

Build and publish wheel to PYPI

Build and publish wheel to PYPI #18

name: Build and publish wheel to PYPI
on:
push:
tags:
- "*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# fetch all history for all branches and tags, so that our `make` targets can get tags
with:
fetch-depth: 0
- name: Fix tag
# Workaround actions/checkout bug
# https://github.com/actions/checkout/issues/290
# https://github.com/actions/checkout/issues/882
if: github.ref_type == 'tag'
run: git fetch -fv origin tag "${GITHUB_REF_NAME}"
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11.2
- name: Cache pip
uses: actions/cache@v3
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Check python
run: make check
- name: Build wheel
run: make build-wheel
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}