Skip to content

v2.3.0

v2.3.0 #12

Workflow file for this run

name: Release
on:
release:
types: [published]
workflow_dispatch:
jobs:
init:
name: Initialize
runs-on: ubuntu-22.04
steps:
- name: Cancel previous workflow
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
linting:
name: Linting
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Configure cache
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip
restore-keys: ${{ runner.os }}-pip
- name: Install dependencies
run: python -m pip install black flake8 isort
- name: Lint code
run: |
flake8 --exclude=.venv .
black . --check
isort .
release:
name: Release
needs: ["init", "linting"]
permissions:
contents: write
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Get version
run: |
APP_VERSION=${GITHUB_REF##*/}
echo "APP_VERSION=${APP_VERSION:1}" >> $GITHUB_ENV
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache Poetry
id: cache-poetry
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip
restore-keys: ${{ runner.os }}-pip
- name: Install Poetry
if: steps.cache-poetry.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Cache dependencies
id: cache-deps
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Install project
run: poetry install --no-interaction
- name: Test
run: poetry run pytest
- name: Build
run: poetry build
- name: Publish - Github
uses: softprops/action-gh-release@v1
if: ${{ matrix.python-version == '3.10' }}
with:
fail_on_unmatched_files: true
files: |
./dist/check_filter-${{ env.APP_VERSION }}-py3-none-any.whl
./dist/check_filter-${{ env.APP_VERSION }}.tar.gz
- name: Publish - PyPi
uses: JRubics/poetry-publish@v2.0
if: ${{ matrix.python-version == '3.10' }}
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}
poetry_install_options: "--without dev"