Skip to content

fix(search): add fallback to improve song search with common words (#… #41

fix(search): add fallback to improve song search with common words (#…

fix(search): add fallback to improve song search with common words (#… #41

Workflow file for this run

name: publish
on:
push:
branches:
- master
workflow_dispatch:
jobs:
project-version-is-changed:
name: Check if project version is changed
runs-on: ubuntu-latest
outputs:
CHANGED: ${{ steps.set-version-changed-var.outputs.CHANGED }}
steps:
- name: Checkout the repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Get the latest version from PyPI
id: get-version-from-pypi
run: |
pypi_version=$(curl -s https://pypi.org/pypi/lyricsgenius/json | jq -r .info.version)
echo "Latest version: $pypi_version"
echo "::set-output name=pypi_version::$pypi_version"
- name: Parse the version from pyproject.toml
id: get-version-from-pyproject
run: |
pyproject_version=$(grep -oP '(?<=^version = ")[^"]*' pyproject.toml)
echo "pyproject.toml version: $pyproject_version"
echo "::set-output name=pyproject_version::$pyproject_version"
- name: Check if the project version is changed
id: set-version-changed-var
run: |
if [ "${{ steps.get-version-from-pypi.outputs.pypi_version }}" != "${{ steps.get-version-from-pyproject.outputs.pyproject_version }}" ]; then
echo "The local project differs from the PyPI version. Need to build and publish."
echo "CHANGED=true" >> $GITHUB_OUTPUT
else
echo "The local project is the same as the PyPI version. No need to build or publish."
echo "CHANGED=false" >> $GITHUB_OUTPUT
fi
build:
name: build
runs-on: ubuntu-latest
needs: project-version-is-changed
if: needs.project-version-is-changed.outputs.CHANGED == 'true'
steps:
- name: Checkout the repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Install uv and set the Python version
uses: astral-sh/setup-uv@0c5e2b8115b80b4c7c5ddf6ffdd634974642d182 # v5.4.1
with:
version: 0.6.11
enable-cache: true
cache-dependency-glob: uv.lock
- name: Set up Python
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.6.0
with:
python-version-file: .python-version
- name: Build the package
run: uv build
- name: Upload artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: built-package
path: dist/
publish-to-pypi:
name: Upload release to PyPI
runs-on: ubuntu-latest
needs: build
environment:
name: pypi
url: https://pypi.org/p/lyricsgenius
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v.4.2.1
with:
name: built-package
path: dist/
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
with:
repository-url: https://upload.pypi.org/legacy/
verbose: false
skip-existing: false