settngs/.github/workflows/build.yaml
2022-12-14 20:57:57 -08:00

67 lines
1.8 KiB
YAML

name: CI
on:
pull_request:
push:
branches:
- '**'
tags:
- "[0-9]+.[0-9]+.[0-9]+*"
jobs:
build-and-publish:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python_version: ['3.8', '3.9','3.10','3.11']
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version }}
- name: Install build dependencies
run: |
python -m pip install --upgrade --upgrade-strategy eager -r requirements-dev.txt
- name: Build and install wheel
run: |
python -m build
python -m pip install dist/*.whl
- name: tox
run: |
tox run -e "py${python_version#py}"
shell: bash
env:
python_version: ${{ matrix.python_version }}
- name: "Publish distribution 📦 to PyPI"
if: startsWith(github.ref, 'refs/tags/') && matrix.python_version == '3.11'
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Get release name
if: startsWith(github.ref, 'refs/tags/') && matrix.python_version == '3.11'
shell: bash
run: |
git fetch --depth=1 origin +refs/tags/*:refs/tags/* # github is dumb
echo "release_name=$(git tag -l --format "%(refname:strip=2): %(contents:lines=1)" ${{ github.ref_name }})" >> $GITHUB_ENV
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/') && matrix.python_version == '3.11'
with:
name: "${{ env.release_name }}"
draft: false
files: |
dist/*.whl