From eaf9222c7ad92fce2665798dd0cca5085c4e5893 Mon Sep 17 00:00:00 2001 From: Rafael Caricio Date: Thu, 5 Nov 2020 18:57:45 +0100 Subject: [PATCH 1/2] Publish to PyPI when releases are created on Github --- .github/workflows/release.yml | 30 ++++++++++++++++++++++++++++++ Makefile | 3 --- scripts/publish.sh | 8 ++++++++ 3 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 scripts/publish.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..86e6b5c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,30 @@ +name: CI + +on: + release: + types: [ created ] + +env: + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + +jobs: + test: + name: Publish to PyPI + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install test dependencies + run: | + python -m pip install --upgrade pip + pip install poetry==1.1.3 + - name: Install Dependencies + run: poetry install + - name: Publish to PyPI + run: | + poetry config pypi-token.pypi ${{ PYPI_TOKEN }} + bash scripts/publish.sh diff --git a/Makefile b/Makefile index 0621336..66210ea 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,3 @@ lint: test: tox - -release: clean-build - poetry publish --build diff --git a/scripts/publish.sh b/scripts/publish.sh new file mode 100644 index 0000000..75a8c04 --- /dev/null +++ b/scripts/publish.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +set -e +set -x + +version=$(git describe --tags --abbrev=0) +poetry version "${version}" +poetry publish --build From 34e7d7f0af4b674d9d3850a8d112ef0ffc08e715 Mon Sep 17 00:00:00 2001 From: Rafael Caricio Date: Thu, 5 Nov 2020 19:31:09 +0100 Subject: [PATCH 2/2] Update readme --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2ab1078..0dc721c 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,6 @@ To run lint, use make lint ## Release Updated Version -First, make sure you have been added as a collaborator [here](https://pypi.org/manage/project/python-elemental/collaboration/). -Manually increase the version [here](https://github.com/cbsinteractive/elemental/blob/master/pyproject.toml#L3) and run - - make release +Use the Github UI to [create a new release](https://github.com/cbsinteractive/elemental/releases/new), the tag needs +to follow the semver format `0.0.0`. After the new release is created, a Github workflow will build and publish the +new python package to PyPI automatically.