From e9d091109b4bda21be1cf473751b1896b3360994 Mon Sep 17 00:00:00 2001 From: S4NKALP Date: Mon, 25 Aug 2025 16:18:44 +0545 Subject: [PATCH] chore: add GitHub Actions workflow to publish package on release --- publish.yml | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 publish.yml diff --git a/publish.yml b/publish.yml new file mode 100644 index 0000000..e698110 --- /dev/null +++ b/publish.yml @@ -0,0 +1,43 @@ +name: Python Package + +on: + release: + types: [created] # Trigger on release tag creation + +jobs: + build-and-publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - name: Install build tools + run: | + python -m pip install --upgrade pip + pip install build twine + + - name: Build package + run: python -m build + + - name: Publish to GitHub Packages + env: + TWINE_USERNAME: ${{ github.actor }} + TWINE_PASSWORD: ${{ secrets.GITHUB_TOKEN }} + run: | + twine upload \ + --repository-url https://upload.pypi.github.com/S4NKALP/DevTools \ + dist/* + + - name: Publish to PyPI (optional) + if: github.event.release.tag_name != '' + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + run: | + twine upload dist/*