Fixes #12
Workflow file for this run
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: | |
branches: | |
- master | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- master | |
concurrency: | |
group: CI-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Install poetry | |
run: pip install "poetry==1.4.2" | |
- name: Install dependencies | |
run: poetry install | |
- name: Lint | |
run: | | |
poetry run ruff keycmd | |
poetry run black --check keycmd | |
build: | |
name: Build and test wheel | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Install poetry | |
run: pip install "poetry==1.4.2" | |
- name: Install dependencies | |
run: poetry install | |
- name: Build wheel | |
run: poetry build | |
- name: Twine check | |
run: poetry run twine check dist/* | |
- name: Upload wheel artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
path: dist | |
name: dist | |
publish: | |
name: Publish release to Github and Pypi | |
runs-on: ubuntu-latest | |
needs: [lint, build] | |
if: success() && startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.9' | |
- name: Download assets | |
uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: | | |
dist/*.tar.gz | |
dist/*.whl | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_PASSWORD }} |