From 707dc9afe133a7cc03503c19d2b9fbb8d25909eb Mon Sep 17 00:00:00 2001 From: Two Dev Date: Sun, 15 Dec 2024 11:25:55 +0700 Subject: [PATCH] CI: auto deploy pypi --- .github/workflows/publish.yml | 43 +++++++++++++---------------------- Makefile | 2 +- 2 files changed, 17 insertions(+), 28 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1c18e58..e43ba9c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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/* diff --git a/Makefile b/Makefile index 0ab0385..ba6bdaf 100644 --- a/Makefile +++ b/Makefile @@ -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: