From b0836bb8282f0641c39d71b3e22cae018e65c00a Mon Sep 17 00:00:00 2001 From: Jesper Dramsch Date: Tue, 30 Jul 2024 16:08:06 +0200 Subject: [PATCH] Enablei Github release as pypi CD trigger --- .github/workflows/cd-pypi.yml | 49 ++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/.github/workflows/cd-pypi.yml b/.github/workflows/cd-pypi.yml index 59b0e0f..c63bf36 100644 --- a/.github/workflows/cd-pypi.yml +++ b/.github/workflows/cd-pypi.yml @@ -1,3 +1,4 @@ +--- name: cd-pypi on: @@ -5,33 +6,33 @@ on: jobs: deploy: - if: ${{ github.ref_type == 'tag' }} + if: ${{ github.ref_type == 'tag' || github.event_name == 'release' }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: "3.x" + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.x" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine build + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine build - - name: Check version - run: | - if [ -f "setup.py" ]; then - release=${{ github.ref_name }} - version=$(python setup.py --version) - test "$release" == "$version" - fi + - name: Check version + run: | + if [ -f "setup.py" ]; then + release=${{ github.ref_name }} + version=$(python setup.py --version) + test "$release" == "$version" + fi - - name: Build and publish - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} - run: | - python -m build - twine upload dist/* + - name: Build and publish + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + run: | + python -m build + twine upload dist/*