Skip to content

Commit

Permalink
Update python-publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
rabii-chaarani committed Apr 10, 2024
1 parent 1a3fa2a commit 9476dd7
Showing 1 changed file with 28 additions and 57 deletions.
85 changes: 28 additions & 57 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Upload FoldOptLib to PyPI

on:
release:
types: [edited, created, published]
types: [ edited, created, published ]

permissions:
contents: read
Expand All @@ -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"
Expand Down Expand Up @@ -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 }}

0 comments on commit 9476dd7

Please sign in to comment.