56 lines
1.5 KiB
YAML
56 lines
1.5 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "[0-9]+.[0-9]+.[0-9]+*"
|
|
|
|
jobs:
|
|
build-and-publish:
|
|
runs-on: ubuntu-latest
|
|
# Specifying a GitHub environment is optional, but strongly encouraged
|
|
environment: release
|
|
permissions:
|
|
# IMPORTANT: this permission is mandatory for trusted publishing
|
|
id-token: write
|
|
contents: write
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python 3.9
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: 3.9
|
|
|
|
- name: Install tox
|
|
run: |
|
|
python -m pip install --upgrade --upgrade-strategy eager tox
|
|
|
|
- name: Build and install wheel
|
|
run: |
|
|
tox run -m build
|
|
python -m pip install dist/*.whl
|
|
|
|
- name: "Publish distribution 📦 to PyPI"
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
|
|
- name: Get release name
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
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/')
|
|
with:
|
|
name: "${{ env.release_name }}"
|
|
draft: false
|
|
files: |
|
|
dist/*.whl
|