Skip to content

Commit 0681aee

Browse files
committed
Upload package to PyPI and Dockerhub
1 parent 1328059 commit 0681aee

File tree

5 files changed

+115
-6
lines changed

5 files changed

+115
-6
lines changed

.dockerignore

+5
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
11
**/*
2+
3+
!src
4+
!**/*.py
5+
!pyproject.toml
6+
!poetry.lock

.github/workflows/deploy.yml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Publish Python Package
2+
3+
on:
4+
push:
5+
tags:
6+
- '[0-2].[0-9]+.[0-9]+*'
7+
8+
jobs:
9+
10+
pypi:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@master
15+
16+
- name: Extract tag name
17+
id: tag_name
18+
run: |
19+
echo ::set-output name=TAG::${GITHUB_REF/refs\/tags\//}
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v1
23+
with:
24+
python-version: "3.8"
25+
26+
- name: Publish Package to PyPI
27+
env:
28+
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
29+
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install poetry
33+
poetry build
34+
poetry publish -u $PYPI_USERNAME -p $PYPI_PASSWORD
35+
36+
- name: Wait for PyPI to update indexes
37+
env:
38+
TAG: ${{ steps.tag_name.outputs.TAG }}
39+
run: |
40+
while [[ -z "$(grep ${TAG} <<< $(pip search audiomatch))" ]]; do
41+
echo "Not there yet...";
42+
sleep 2s
43+
done;
44+
45+
dockerhub:
46+
needs: pypi
47+
48+
runs-on: ubuntu-latest
49+
50+
steps:
51+
- uses: actions/checkout@master
52+
53+
- name: Extract tag name
54+
id: tag_name
55+
run: |
56+
echo ::set-output name=TAG::${GITHUB_REF/refs\/tags\//}
57+
58+
- name: Build Docker image
59+
env:
60+
TAG: ${{ steps.tag_name.outputs.TAG }}
61+
run: |
62+
docker build . -t fdooch/audiomatch:"${TAG}" --build-arg package_version="${TAG}"
63+
64+
- name: Log in to the Dockerhub registry
65+
env:
66+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
67+
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
68+
run: |
69+
echo "${DOCKERHUB_TOKEN}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin
70+
71+
- name: Push to Dockerhub
72+
run: |
73+
docker push fdooch/audiomatch:"${TAG}"

Dockerfile

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,9 @@ RUN apk update \
55
&& echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
66
&& apk add --no-cache chromaprint-dev
77

8-
CMD ["/bin/sh"]
8+
ARG package_version
9+
ENV PACKAGE_VERSION=$package_version
10+
11+
RUN pip3 install "audiomatch==${PACKAGE_VERSION}"
12+
13+
ENTRYPOINT ["audiomatch"]

README.rst

+17-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,19 @@ audiomatch
66
:alt: Build Status
77
:target: https://github.com/unmade/audiomatch/blob/master/.github/workflows/lint-and-test.yml
88

9+
.. image:: https://codecov.io/gh/unmade/audiomatch/branch/master/graph/badge.svg
10+
:alt: Coverage Status
11+
:target: https://codecov.io/gh/unmade/audiomatch
12+
13+
.. image:: https://img.shields.io/pypi/v/audiomatch.svg
14+
:alt: PyPI Package latest release
15+
:target: https://pypi.org/project/audiomatch
16+
17+
.. image:: https://img.shields.io/badge/License-MIT-purple.svg
18+
:alt: MIT License
19+
:target: https://github.com/unmade/apiwrappers/blob/master/LICENSE
20+
21+
922
A small command-line tool to find similar audio files
1023

1124
Installation
@@ -26,7 +39,7 @@ docker:
2639

2740
.. code-block:: bash
2841
29-
docker run --rm -v=/path/to/audio/folder:/tmp -it fdooch/audiomatch /bin/sh
42+
docker run --rm -v "$(pwd)":/tmp fdooch/audiomatch "/tmp/*"
3043
3144
Quickstart
3245
==========
@@ -62,7 +75,9 @@ Let's find out which files sound similar:
6275
./demo/Pennyroyal Tea (Solo Acoustic).mp3
6376
./demo/Pennyroyal Tea (Unplugged in NYC).m4a
6477
65-
*Note: input audio files should be at least 10 seconds long*
78+
*Note #1: input audio files should be at least 10 seconds long*
79+
80+
*Note #2: in some rare cases false positives are possible*
6681

6782
What's happening here is that *audiomatch* takes all audio files from the directory and
6883
compares them with each other.

pyproject.toml

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
[tool.poetry]
22
name = "audiomatch"
3-
version = "0.1.0"
4-
description = ""
3+
version = "0.1.4"
4+
description = "A small command-line tool to find similar audio files"
5+
keywords = ["duplicate", "detection", "audio", "fingerprinting", "command-line"]
6+
readme = "README.rst"
57
authors = ["Aleksei Maslakov <[email protected]>"]
8+
license = "MIT"
69
packages = [
710
{ include = "audiomatch", from = "src" },
811
]
12+
classifiers = [
13+
"Development Status :: 4 - Beta",
14+
"License :: OSI Approved :: MIT License",
15+
"Operating System :: OS Independent",
16+
"Programming Language :: Python :: 3.8",
17+
"Topic :: Multimedia :: Sound/Audio :: Analysis",
18+
"Typing :: Typed",
19+
]
920

1021
[tool.poetry.scripts]
11-
audiomatch = "audiomatch.cli:main"
22+
audiomatch = "audiomatch.cli:invoke"
1223

1324
[tool.poetry.dependencies]
1425
python = "^3.8"

0 commit comments

Comments
 (0)