feat(release): add workflow to automatically publish package on release creation
This commit is contained in:
1 file changed
+43
@@ -0,0 +1,43 @@
|
|||||||
|
name: Publish Python Package
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [created] # Trigger when a release is created
|
||||||
|
|
||||||
|
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: Upgrade pip and 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/*
|
||||||
Reference in new issue
Block a user