Update CI.yaml #31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: push | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.10, 3.11, 3.12] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install .[dev] | |
- name: Lint | |
run: | | |
black ./ --check --verbose | |
flake8 --verbose | |
# pre-commit install | |
# pre-commit run --all | |
check-tag: | |
needs: [lint] | |
runs-on: ubuntu-latest | |
if: contains(github.ref, 'tags') && (!contains(github.ref_name, 'dev')) && (!contains(github.ref_name, 'rc')) | |
steps: | |
- run: echo "Tag '${{ github.ref_name }}' is valid." | |
release: | |
needs: [check-tag] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
with: | |
tag_name: ${{ github.ref_name }} | |
release_name: "${{ github.ref_name }}" | |
body: "🚀 Release: ${{ github.event.repository.name }} @ ${{ github.ref_name }}" | |
draft: false | |
prerelease: false | |
deploy: | |
needs: [release] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v1 | |
with: | |
python-version: "3.x" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -U setuptools setuptools_scm wheel twine | |
- name: Build and publish | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }} | |
run: | | |
python setup.py sdist bdist_wheel | |
twine upload dist/* --verbose |