From fbcae98390d50b6f999a05ec7b9e330b715878d8 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Sun, 18 Jul 2021 19:31:46 +0200 Subject: [PATCH 1/4] add metadata on PyPI through pyproject.toml --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 7f109e9..1256ae8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,6 +4,9 @@ version = "3.0.0" description = "Post a message to a matrix room with a simple HTTP POST" authors = ["Guilhem Saurel "] license = "BSD-2-Clause" +readme = "README.md" +homepage = "https://github.com/nim65s/matrix-webhook" +repository = "https://github.com/nim65s/matrix-webhook.git" [tool.poetry.dependencies] python = "^3.9" From dcc73dfc81639d408fb3727bec053d0a514a57a2 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Sun, 18 Jul 2021 19:55:15 +0200 Subject: [PATCH 2/4] setup action to build/publish on docker hub --- .github/workflows/publish.yml | 29 +++++++++++++++++++++++++++++ README.md | 1 + 2 files changed, 30 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..0ed948c --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,29 @@ +name: Publish Docker image + +on: + push: + branches: + - 'master' + - 'devel' + tags: + - 'v*' + +jobs: + docker-hub: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: docker/metadata-action@v3 + id: meta + with: + images: nim65s/matrix-webhook + - uses: docker/login-action@v1 + with: + username: nim65s + password: ${{ secrets.DOCKERHUB_TOKEN }} + - uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/README.md b/README.md index d9517ed..29a19cc 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Tests](https://github.com/nim65s/matrix-webhook/actions/workflows/test.yml/badge.svg)](https://github.com/nim65s/matrix-webhook/actions/workflows/test.yml) [![Lints](https://github.com/nim65s/matrix-webhook/actions/workflows/lint.yml/badge.svg)](https://github.com/nim65s/matrix-webhook/actions/workflows/lint.yml) +[![Publish](https://github.com/nim65s/matrix-webhook/actions/workflows/publish.yml/badge.svg)](https://github.com/nim65s/matrix-webhook/actions/workflows/publish.yml) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![codecov](https://codecov.io/gh/nim65s/matrix-webhook/branch/master/graph/badge.svg?token=BLGISGCYKG)](https://codecov.io/gh/nim65s/matrix-webhook) From 932965c8af3be1dcb12596622bbafbd68d8bfcd1 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Sun, 18 Jul 2021 21:09:51 +0200 Subject: [PATCH 3/4] setup action to build/publish on PyPI --- .github/workflows/{publish.yml => docker-hub.yml} | 3 +-- .github/workflows/pypi.yml | 15 +++++++++++++++ README.md | 3 ++- pyproject.toml | 2 +- 4 files changed, 19 insertions(+), 4 deletions(-) rename .github/workflows/{publish.yml => docker-hub.yml} (93%) create mode 100644 .github/workflows/pypi.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/docker-hub.yml similarity index 93% rename from .github/workflows/publish.yml rename to .github/workflows/docker-hub.yml index 0ed948c..8fa86ac 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/docker-hub.yml @@ -1,10 +1,9 @@ -name: Publish Docker image +name: Publish on: push: branches: - 'master' - - 'devel' tags: - 'v*' diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml new file mode 100644 index 0000000..ee77ec4 --- /dev/null +++ b/.github/workflows/pypi.yml @@ -0,0 +1,15 @@ +name: PyPI + +on: + push: + tags: + - 'v*' + +jobs: + pypi: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - run: pip install -U poetry twine wheel + - run: poetry build + - run: twine upload --non-interactive -u __token__ -p ${{ secrets.PYPI_TOKEN }} dist/* diff --git a/README.md b/README.md index 29a19cc..a0fe1fe 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ [![Tests](https://github.com/nim65s/matrix-webhook/actions/workflows/test.yml/badge.svg)](https://github.com/nim65s/matrix-webhook/actions/workflows/test.yml) [![Lints](https://github.com/nim65s/matrix-webhook/actions/workflows/lint.yml/badge.svg)](https://github.com/nim65s/matrix-webhook/actions/workflows/lint.yml) -[![Publish](https://github.com/nim65s/matrix-webhook/actions/workflows/publish.yml/badge.svg)](https://github.com/nim65s/matrix-webhook/actions/workflows/publish.yml) +[![Docker-Hub](https://github.com/nim65s/matrix-webhook/actions/workflows/docker-hub.yml/badge.svg)](https://hub.docker.com/r/nim65s/matrix-webhook) +[![PyPI](https://github.com/nim65s/matrix-webhook/actions/workflows/pypi.yml/badge.svg)](https://pypi.org/project/matrix-webhook/) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![codecov](https://codecov.io/gh/nim65s/matrix-webhook/branch/master/graph/badge.svg?token=BLGISGCYKG)](https://codecov.io/gh/nim65s/matrix-webhook) diff --git a/pyproject.toml b/pyproject.toml index 1256ae8..b85b4ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ homepage = "https://github.com/nim65s/matrix-webhook" repository = "https://github.com/nim65s/matrix-webhook.git" [tool.poetry.dependencies] -python = "^3.9" +python = "^3.8" Markdown = "^3.3.4" matrix-nio = "^0.18.3" From 71c9c6cb0e7bb4ad11bacfda7c65f5b88f8367b9 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Sun, 18 Jul 2021 22:53:29 +0200 Subject: [PATCH 4/4] changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41eb596..b8dd191 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- Publish on PyPI & Docker Hub with Github Actions + in [#10](https://github.com/nim65s/matrix-webhook/pull/10) + by [@nim65s](https://github.com/) + ## [3.0.0] - 2021-07-18 - Simplify code