From 5342a2c67b393b1128a5bced5d958f4653584db7 Mon Sep 17 00:00:00 2001 From: MartinBelthle Date: Tue, 26 Nov 2024 17:24:18 +0100 Subject: [PATCH] feat(gh): add release gh action (#14) --- .github/workflows/publish.yml | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 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 00000000..75fc1a45 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,42 @@ +# This workflow will upload a Python Package using Twine when a release is created +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Publish Python 🐍 distributions 📦 to PyPI + +on: + release: + types: [ published ] + +permissions: + contents: read + +jobs: + deploy: + + runs-on: ubuntu-22.04 + environment: PyPi + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install build + - name: Build Python 🐍 packages + run: python -m build + - name: Publish distribution 📦 to PyPI + # Upload packages only on a tagged commit + if: startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} \ No newline at end of file