From a0d5d8127045462dfce47474e423eec1f06656ed Mon Sep 17 00:00:00 2001 From: mariugul Date: Thu, 29 Aug 2024 01:27:38 +0200 Subject: [PATCH 1/4] refactor: add version.py file Keeps track of the python package version. --- pikaraoke/__init__.py | 4 ++-- pikaraoke/app.py | 4 ++-- pikaraoke/constants.py | 1 - pikaraoke/version.py | 1 + 4 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 pikaraoke/version.py diff --git a/pikaraoke/__init__.py b/pikaraoke/__init__.py index d5d0bb74..c5828b0a 100644 --- a/pikaraoke/__init__.py +++ b/pikaraoke/__init__.py @@ -1,9 +1,9 @@ -from pikaraoke.constants import VERSION from pikaraoke.karaoke import Karaoke from pikaraoke.lib.get_platform import get_platform +from pikaraoke.version import __version__ -__version__ = VERSION PACKAGE = __package__ +VERSION = __version__ __all__ = [ "VERSION", diff --git a/pikaraoke/app.py b/pikaraoke/app.py index 16ca0afe..e7882dda 100644 --- a/pikaraoke/app.py +++ b/pikaraoke/app.py @@ -33,8 +33,8 @@ from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import WebDriverWait -from pikaraoke import karaoke -from pikaraoke.constants import LANGUAGES, VERSION +from pikaraoke import VERSION, karaoke +from pikaraoke.constants import LANGUAGES from pikaraoke.lib.get_platform import get_platform, is_raspberry_pi try: diff --git a/pikaraoke/constants.py b/pikaraoke/constants.py index 1eb38bf0..d2e4ba2c 100644 --- a/pikaraoke/constants.py +++ b/pikaraoke/constants.py @@ -1,4 +1,3 @@ -VERSION = "1.2.1" LANGUAGES = { "en": "English", "zh_CN": "Chinese", diff --git a/pikaraoke/version.py b/pikaraoke/version.py new file mode 100644 index 00000000..67bc602a --- /dev/null +++ b/pikaraoke/version.py @@ -0,0 +1 @@ +__version__ = "1.3.0" From caa05d09f1996375817dd85e32324c7b1a8a92f1 Mon Sep 17 00:00:00 2001 From: mariugul Date: Thu, 29 Aug 2024 01:29:35 +0200 Subject: [PATCH 2/4] ci: add release-please Adds release please as a tool to automatically create PR's in GitHub incrementing python package versions, as well as building and publishing packages to PyPi on new releases. --- .github/workflows/release-please.yml | 73 ++++++++++++++++++++++++++++ .release-please-manifest.json | 0 pikaraoke/version.py | 2 +- pyproject.toml | 2 +- release-please-config.json | 13 +++++ 5 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release-please.yml create mode 100644 .release-please-manifest.json create mode 100644 release-please-config.json diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 00000000..381f331d --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,73 @@ +on: + push: + branches: + - master + +name: release-please + +permissions: + contents: write + pull-requests: write + + +jobs: + release-please: + runs-on: ubuntu-latest + outputs: + release_created: ${{ steps.release.outputs.release_created }} + steps: + - name: Release Please + id: release + uses: googleapis/release-please-action@v4 + with: + token: ${{ secrets.RELEASE_PLEASE_TOKEN }} + + build-and-publish: + runs-on: ubuntu-latest + needs: release-please + if: ${{ needs.release-please.outputs.release_created == 'true' }} + permissions: + # IMPORTANT: this permission is mandatory for trusted publishing + id-token: write + environment: + name: pypi + url: https://pypi.org/p/pikaraoke + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.9' + + - name: Cache Poetry Install + id: cache-poetry + uses: actions/cache@v4 + with: + path: | + /opt/poetry + ~/.cache/pypoetry + .venv + key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}-${{ hashFiles('**/pyproject.toml') + }} + + - name: Install Poetry + if: steps.cache-poetry.outputs.cache-hit != 'true' + run: | + export POETRY_HOME=/opt/poetry + python3 -m venv $POETRY_HOME + $POETRY_HOME/bin/pip install poetry==1.8.2 + $POETRY_HOME/bin/poetry --version + + - name: Add Poetry to PATH + run: echo "/opt/poetry/bin" >> $GITHUB_PATH + + - name: Install Package + run: poetry install --no-interaction --no-ansi + + - name: Build Package + run: poetry build + + - name: Publish Python 🐍 distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 00000000..e69de29b diff --git a/pikaraoke/version.py b/pikaraoke/version.py index 67bc602a..e4befbfd 100644 --- a/pikaraoke/version.py +++ b/pikaraoke/version.py @@ -1 +1 @@ -__version__ = "1.3.0" +__version__ = "1.3.0" # {x-release-please-version} diff --git a/pyproject.toml b/pyproject.toml index 22d983db..7c8d14ae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "pikaraoke" -version = "1.0.0" +version = "1.3.0" description = "Youtube-based Karaoke machine for Raspberry Pi, OSX, Windows, and Linux" authors = ["Vic Wong"] diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 00000000..0efc5904 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "packages": { + ".": { + "package-name": "pikaraoke", + "release-type": "python", + "include-component-in-tag": false, + "include-v-in-tag": false, + "changelog-path": "pikaraoke/CHANGELOG.md", + "version-file": "pikaraoke/version.py" + } + } +} From d5ac686539205550d7bb3ab5691e8f984b16f187 Mon Sep 17 00:00:00 2001 From: mariugul Date: Thu, 29 Aug 2024 09:07:57 +0200 Subject: [PATCH 3/4] ci: add conventional commit checker --- .github/workflows/ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c25b9ee..c8663f05 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,3 +44,10 @@ jobs: mv code_quality/.docstr.yaml . # --config option didn't work docstr-coverage 2>&1 | tee docstr/docstring_coverage.txt ls docs/badges + + commitlint: + runs-on: ubuntu-latest + name: Commitlint + steps: + - name: Run commitlint + uses: opensource-nepal/commitlint@v1 From 0c63c7db4933bfe4549b19b04dc7a46a342039a6 Mon Sep 17 00:00:00 2001 From: mariugul Date: Mon, 2 Sep 2024 15:58:07 +0200 Subject: [PATCH 4/4] docs: add conventional commits badge --- docs/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/README.md b/docs/README.md index b5ab909f..f375c31e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,5 +1,7 @@ # PiKaraoke +[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-green.svg)](https://conventionalcommits.org) + PiKaraoke is a "KTV"-style karaoke song search and queueing system. It connects to your TV, and shows a QR code for computers and smartphones to connect to a web interface. From there, multiple users can seamlessly search your local track library, queue up songs, add an endless selection of new karaoke tracks from YouTube, and more. Works on Raspberry Pi, OSX, Windows, and Linux! If you want to support this project with a little monetary tip, it's much appreciated: