From 13a3bab5ff688dcaa195ce15ce1d530370bf4750 Mon Sep 17 00:00:00 2001 From: "cool.gitter.not.me.again.duh" Date: Sat, 31 May 2025 16:24:08 -0600 Subject: [PATCH] 0.2.0 --- .github/workflows/publish-to-pypi.yml | 62 +++++++++++++++++++++++++++ setup.py | 2 +- 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish-to-pypi.yml diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml new file mode 100644 index 0000000..54e5a40 --- /dev/null +++ b/.github/workflows/publish-to-pypi.yml @@ -0,0 +1,62 @@ +name: Publish Python Package to PyPI + +on: + release: + types: [published] + +jobs: + pypi-publish: + name: Upload release to PyPI + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/librespot-spotizerr # Optional: Link to your PyPI project + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Get version from tag + id: get_version + run: | + # Strip 'v' prefix if present + VERSION_TAG="${GITHUB_REF_NAME#v}" + echo "VERSION=$VERSION_TAG" >> $GITHUB_OUTPUT + echo "Using version for build: $VERSION_TAG" + + - name: Update version in setup.py + run: | + VERSION_TAG="${{ steps.get_version.outputs.VERSION }}" + sed -i "s/\\(version *= *[\\"']\\)[^\\"']*\([\\"']\\)/\\1$VERSION_TAG\\2/" setup.py + echo "Updated setup.py to version $VERSION_TAG for build:" + cat setup.py + + - name: Update version in librespot/__init__.py + run: | + VERSION_TAG="${{ steps.get_version.outputs.VERSION }}" + sed -i "s/\\(version_name *= *[\\"']\\)[^\\"']*\([\\"']\\)/\\1$VERSION_TAG\\2/" librespot/__init__.py + echo "Updated librespot/__init__.py to version $VERSION_TAG for build:" + cat librespot/__init__.py + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.x" + + - name: Install build dependencies + run: | + python -m pip install --upgrade pip + pip install build + + - name: Build package + run: python -m build + + - name: Publish package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + # No need for user/password with trusted publishing + # If not using trusted publishing, you would uncomment and use: + # with: + # user: __token__ + # password: ${{ secrets.PYPI_API_TOKEN }} \ No newline at end of file diff --git a/setup.py b/setup.py index 986ef9a..84df6cd 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ import setuptools -setuptools.setup(name="librespot", +setuptools.setup(name="librespot-spotizerr", version="0.1.0", description="Spotizerr's python librespot implementation", long_description=open("README.md").read(),