From 9476dd78e6f92936d3fe6c43b5fc19d5cea6337a Mon Sep 17 00:00:00 2001 From: Rabii Chaarani <50892556+rabii-chaarani@users.noreply.github.com> Date: Thu, 11 Apr 2024 08:14:04 +0930 Subject: [PATCH] Update python-publish.yml --- .github/workflows/python-publish.yml | 85 +++++++++------------------- 1 file changed, 28 insertions(+), 57 deletions(-) diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index f532f15..d956ea6 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -2,7 +2,7 @@ name: Upload FoldOptLib to PyPI on: release: - types: [edited, created, published] + types: [ edited, created, published ] permissions: contents: read @@ -11,8 +11,8 @@ jobs: build-and-test: strategy: matrix: - os: [windows-latest, ubuntu-latest, macos-latest] - python-version: ["3.9", "3.10", "3.11"] + os: [ windows-latest, ubuntu-latest, macos-latest ] + python-version: [ "3.9", "3.10", "3.11" ] include: - os: windows-latest compiler: "msvc" @@ -50,62 +50,33 @@ jobs: - name: Build and Test run: | python setup.py sdist bdist_wheel + + + + + publish: + needs: build-and-test + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + steps: + - uses: actions/checkout@v3 - publish: - needs: build-and-test - runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/') - strategy: - matrix: - python-version: ["3.9", "3.10", "3.11"] - steps: - - uses: actions/checkout@v3 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - - name: Upgrade pip - run: python -m pip install --upgrade pip - - - name: Install twine - run: pip install twine + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} - - name: Build Package - run: python setup.py sdist bdist_wheel + - name: Build Package + run: python setup.py sdist bdist_wheel - - name: Publish to PyPI - if: matrix.python-version == '3.9' # Only publish once, for the first version - uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} + - name: Upgrade pip + run: python -m pip install --upgrade pip + - name: Install twine + run: pip install twine -# publish: -# needs: build-and-test -# runs-on: ubuntu-latest -# if: startsWith(github.ref, 'refs/tags/') -# steps: -# - uses: actions/checkout@v3 -# -# - name: Set up Python -# uses: actions/setup-python@v3 -# with: -# python-version: ${{ matrix.python-version }} -# -# - name: Build Package -# run: python setup.py sdist bdist_wheel -# -# - name: Upgrade pip -# run: python -m pip install --upgrade pip -# -# - name: Install twine -# run: pip install twine -# -# - name: Publish to PyPI -# uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 -# with: -# user: __token__ -# password: ${{ secrets.PYPI_API_TOKEN }} + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }}