From c0278c7ee7916a5879b63cf377dcaed097f6b9e3 Mon Sep 17 00:00:00 2001 From: Shady Baseely Date: Wed, 3 Jan 2024 00:28:27 +0200 Subject: [PATCH] Add GitHub Action for PyPi packages (#6) - Implemented a GitHub Action to automatically publish the package to PyPI upon new tag releases. - Action builds the package, creates distribution files, and uploads them to PyPI. Closes #6 --- .github/workflows/push_wheel_to_pypi.yml | 56 ++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/push_wheel_to_pypi.yml diff --git a/.github/workflows/push_wheel_to_pypi.yml b/.github/workflows/push_wheel_to_pypi.yml new file mode 100644 index 0000000..f5dadab --- /dev/null +++ b/.github/workflows/push_wheel_to_pypi.yml @@ -0,0 +1,56 @@ +name: Publish to PyPI +on: + push + +jobs: + pypi-publish: + name: Upload release to PyPI + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/fossil + permissions: + id-token: write + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install --upgrade setuptools wheel + pip install --upgrade twine + + - name: Build and publish wheel + run: | + python -m build + twine upload dist/*.whl + + - name: Get tag name + id: tag_name + run: echo "##vso[task.setvariable variable=tag_name;isOutput=true]" & + git describe --tags --abbrev=0 + + build: + name: Build distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install --upgrade setuptools wheel + pip install --upgrade twine + - name: Build and publish wheel + run: | + python -m build + twine upload dist/*.whl