Skip to content

Commit

Permalink
only push to pypi if the PR is merged to main
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaiton committed Nov 28, 2023
1 parent b4bd303 commit 8791f41
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build package wheel
name: build macos and windows wheels

on:
push:
Expand Down Expand Up @@ -35,14 +35,30 @@ jobs:
- name: Build Wheel with Flit
run: flit build

- name: Test Install Wheel
run: pip install dist/*.whl

- name: Upload to GitHub Artifacts
uses: actions/upload-artifact@v2
with:
name: python-package
path: dist/*.whl

publish-to-pypi:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x" # Use the latest version of Python 3

- name: Install Flit
run: python -m pip install flit

- name: Publish to PyPI
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: flit publish --repository pypi
env:
FLIT_USERNAME: ${{ secrets.PYPI_USERNAME }}
Expand Down

0 comments on commit 8791f41

Please sign in to comment.