From 9c5826dffa35eb1a1411d45e93abc0802a85cadc Mon Sep 17 00:00:00 2001 From: Dustin Whited Date: Mon, 24 Apr 2023 19:50:24 -0500 Subject: [PATCH] add publishing to pypi (#14) * add publishing to pypi --- .github/workflows/publish.yml | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 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..a0fa335 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,40 @@ +name: Publish Python Package to PYPI + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + publish-release: + name: Build and publish to PyPI + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Set up Python 3.10 + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Update setup.cfg version from tag + run: | + VERSION=${{ github.event.release.tag_name }} + VERSION=${VERSION:1} + sed -i "s/version =.*/version = ${VERSION}/g" setup.cfg + + - name: Install build + run: | + pip install -q build + + - name: Build package + run: | + python -m build + + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }}