feat(ci): add workflow to publish package on release creation

This commit is contained in:
sankalp committed 2025-08-25 16:21:02 +05:45
1 parent e9d091109b
commit 6c51d04df4
1 file changed
+43
View File
@@ -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/*