Skip to content

Minor refactoring release #3

Minor refactoring release

Minor refactoring release #3

Workflow file for this run

name: Lint and test
on:
pull_request:
branches: ['master']
push:
branches: ['master']
tags: [ '*' ]
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install poetry
run: pip install poetry
- name: Install dependencies
run: poetry install --with main,dev
- name: Run linters
run: make lint
test:
name: Test
strategy:
matrix:
python-version: ['3.10', '3.11']
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
run: pip install poetry
- name: Install dependencies
run: poetry install --with main,dev
- name: Run tests
run: make test
publish:
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install poetry
run: pip install poetry
- name: Publish to PyPI
run: poetry publish --build
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
- name: Login to DockerHub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
- name: Build and push Docker image
run: |
docker build -t ${{ secrets.DOCKER_USERNAME }}/tg-odesli-bot:${{ github.ref }} .
docker push ${{ secrets.DOCKER_USERNAME }}/tg-odesli-bot:${{ github.ref }}