Skip to content

Commit

Permalink
CI: auto deploy pypi
Browse files Browse the repository at this point in the history
  • Loading branch information
Two Dev committed Dec 15, 2024
1 parent 8dd6467 commit 707dc9a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 28 deletions.
43 changes: 16 additions & 27 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,22 @@ on:
types: [created]

jobs:
testpypi-publish:
name: Publish release to TestPyPI
publish:
name: Publish PyPI
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
environment:
name: pypi
url: https://pypi.org/p/wrapper-tls-requests
permissions:
id-token: write # IMPORTANT: mandatory for sigstore
steps:
- name: Publish package to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/

pypi-publish:
name: Publish release to PyPI
needs: testpypi-publish
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/wrapper-tls-requests
permissions:
id-token: write # IMPORTANT: mandatory for sigstore
steps:
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
python-version: '3.9'
- name: Install pypa/build
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ publish-test-pypi:
python -m pip install -r requirements-dev.txt
python -m pip install 'twine>=6.0.1'
python setup.py sdist bdist_wheel
twine upload --repository testpypi dist/*
twine upload --repository testpypi --skip-existing dist/*
rm -rf build dist .egg wrapper_tls_requests.egg-info

publish-pypi:
Expand Down

0 comments on commit 707dc9a

Please sign in to comment.