Skip to content

Commit

Permalink
Upload package to PyPI and Dockerhub
Browse files Browse the repository at this point in the history
  • Loading branch information
unmade committed Apr 5, 2020
1 parent 1328059 commit 0681aee
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
**/*

!src
!**/*.py
!pyproject.toml
!poetry.lock
73 changes: 73 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Publish Python Package

on:
push:
tags:
- '[0-2].[0-9]+.[0-9]+*'

jobs:

pypi:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@master

- name: Extract tag name
id: tag_name
run: |
echo ::set-output name=TAG::${GITHUB_REF/refs\/tags\//}
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: "3.8"

- name: Publish Package to PyPI
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m pip install --upgrade pip
pip install poetry
poetry build
poetry publish -u $PYPI_USERNAME -p $PYPI_PASSWORD
- name: Wait for PyPI to update indexes
env:
TAG: ${{ steps.tag_name.outputs.TAG }}
run: |
while [[ -z "$(grep ${TAG} <<< $(pip search audiomatch))" ]]; do
echo "Not there yet...";
sleep 2s
done;
dockerhub:
needs: pypi

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@master

- name: Extract tag name
id: tag_name
run: |
echo ::set-output name=TAG::${GITHUB_REF/refs\/tags\//}
- name: Build Docker image
env:
TAG: ${{ steps.tag_name.outputs.TAG }}
run: |
docker build . -t fdooch/audiomatch:"${TAG}" --build-arg package_version="${TAG}"
- name: Log in to the Dockerhub registry
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
run: |
echo "${DOCKERHUB_TOKEN}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin
- name: Push to Dockerhub
run: |
docker push fdooch/audiomatch:"${TAG}"
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,9 @@ RUN apk update \
&& echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
&& apk add --no-cache chromaprint-dev

CMD ["/bin/sh"]
ARG package_version
ENV PACKAGE_VERSION=$package_version

RUN pip3 install "audiomatch==${PACKAGE_VERSION}"

ENTRYPOINT ["audiomatch"]
19 changes: 17 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ audiomatch
:alt: Build Status
:target: https://github.com/unmade/audiomatch/blob/master/.github/workflows/lint-and-test.yml

.. image:: https://codecov.io/gh/unmade/audiomatch/branch/master/graph/badge.svg
:alt: Coverage Status
:target: https://codecov.io/gh/unmade/audiomatch

.. image:: https://img.shields.io/pypi/v/audiomatch.svg
:alt: PyPI Package latest release
:target: https://pypi.org/project/audiomatch

.. image:: https://img.shields.io/badge/License-MIT-purple.svg
:alt: MIT License
:target: https://github.com/unmade/apiwrappers/blob/master/LICENSE


A small command-line tool to find similar audio files

Installation
Expand All @@ -26,7 +39,7 @@ docker:

.. code-block:: bash
docker run --rm -v=/path/to/audio/folder:/tmp -it fdooch/audiomatch /bin/sh
docker run --rm -v "$(pwd)":/tmp fdooch/audiomatch "/tmp/*"
Quickstart
==========
Expand Down Expand Up @@ -62,7 +75,9 @@ Let's find out which files sound similar:
./demo/Pennyroyal Tea (Solo Acoustic).mp3
./demo/Pennyroyal Tea (Unplugged in NYC).m4a
*Note: input audio files should be at least 10 seconds long*
*Note #1: input audio files should be at least 10 seconds long*

*Note #2: in some rare cases false positives are possible*

What's happening here is that *audiomatch* takes all audio files from the directory and
compares them with each other.
Expand Down
17 changes: 14 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
[tool.poetry]
name = "audiomatch"
version = "0.1.0"
description = ""
version = "0.1.4"
description = "A small command-line tool to find similar audio files"
keywords = ["duplicate", "detection", "audio", "fingerprinting", "command-line"]
readme = "README.rst"
authors = ["Aleksei Maslakov <lesha.maslakov@gmail.com>"]
license = "MIT"
packages = [
{ include = "audiomatch", from = "src" },
]
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.8",
"Topic :: Multimedia :: Sound/Audio :: Analysis",
"Typing :: Typed",
]

[tool.poetry.scripts]
audiomatch = "audiomatch.cli:main"
audiomatch = "audiomatch.cli:invoke"

[tool.poetry.dependencies]
python = "^3.8"
Expand Down

0 comments on commit 0681aee

Please sign in to comment.