From 8ac08a9f9e967cda82ab4e2c503170af675949be Mon Sep 17 00:00:00 2001 From: Philip Vanloo Date: Mon, 19 Feb 2024 10:09:15 +0100 Subject: [PATCH] p --- .github/workflows/release.yaml | 52 ++++++++++++++++++++++++++++++++++ .github/workflows/test.yaml | 24 ++++++++++++++++ README.md | 5 ++++ setup.cfg | 2 +- setup.py | 3 +- tox.ini | 1 + 6 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release.yaml create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..350148c --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,52 @@ +name: release +run-name: Creating releases/${{ inputs.version }} + +on: + workflow_dispatch: + inputs: + version: + description: 'Version' + required: true + type: string + +jobs: + create_release_branch: + name: Create release branch + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Update version + run: | + echo -n "${{ github.event.inputs.version }}" > version.txt + sed -i 's/version = [^;]*/version = ${{ github.event.inputs.version }}/g' setup.cfg + - name: Create release branch + run: | + git config --local user.name "github-actions[bot]" + git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" + git checkout -B releases/${{ github.event.inputs.version }} + git commit --allow-empty -am "Create version ${{ github.event.inputs.version }}" + git push --set-upstream origin releases/${{ github.event.inputs.version }} + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: 3.11 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox tox-gh-actions + - name: Test with tox + run: tox + + pypi-publish: + runs-on: ubuntu-latest + name: Upload release to PyPI + environment: + name: pypi + url: https://pypi.org/p/python-linkplay + permissions: + id-token: write + steps: + - uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..2363af2 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,24 @@ +name: test + +on: [push, pull_request] + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + python-version: ['3.11'] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install tox tox-gh-actions + - name: Test with tox + run: tox \ No newline at end of file diff --git a/README.md b/README.md index 71f09fa..dc4c410 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ + +[![PyPI package](https://badge.fury.io/py/python-linkplay.svg)](https://pypi.org/project/python-linkplay/) + +[![Release](https://github.com/velleman/python-linkplay/actions/workflows/release/badge.svg)](https://github.com/velleman/python-linkplay/actions/workflows/release.yaml) + # python-linkplay A Python Library for Seamless LinkPlay Device Control diff --git a/setup.cfg b/setup.cfg index 81dd3d4..878c963 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ name = python_linkplay description = Python library to control LinkPlay devices author = Velleman Group nv -version = 0.0.0 +version = 0.0.1 [options] packages = find_namespace: diff --git a/setup.py b/setup.py index 57c026b..26e08e4 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,5 @@ from setuptools import setup + if __name__ == "__main__": - setup() \ No newline at end of file + setup() diff --git a/tox.ini b/tox.ini index a157cd2..5de764f 100644 --- a/tox.ini +++ b/tox.ini @@ -8,6 +8,7 @@ python = 3.11: py311, mypy, flake8 [testenv] +package = wheel setenv = PYTHONPATH = {toxinidir} deps =