Skip to content

Commit 4d64840

Browse files
committed
Upload package to PyPI and Dockerhub
1 parent 1328059 commit 4d64840

File tree

5 files changed

+116
-6
lines changed

5 files changed

+116
-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

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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 ! pip install "audiomatch==${TAG}"; do
41+
sleep 2s
42+
done;
43+
44+
dockerhub:
45+
needs: pypi
46+
47+
runs-on: ubuntu-latest
48+
49+
steps:
50+
- uses: actions/checkout@master
51+
52+
- name: Extract tag name
53+
id: tag_name
54+
run: |
55+
echo ::set-output name=TAG::${GITHUB_REF/refs\/tags\//}
56+
57+
- name: Build Docker image
58+
env:
59+
TAG: ${{ steps.tag_name.outputs.TAG }}
60+
run: |
61+
docker build . -t fdooch/audiomatch:"${TAG}" --build-arg package_version="${TAG}"
62+
63+
- name: Log in to the Dockerhub registry
64+
env:
65+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
66+
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
67+
run: |
68+
echo "${DOCKERHUB_TOKEN}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin
69+
70+
- name: Push to Dockerhub
71+
env:
72+
TAG: ${{ steps.tag_name.outputs.TAG }}
73+
run: |
74+
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.6"
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)