Skip to content

Commit

Permalink
support macos publish
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuwei Yan committed Jan 6, 2025
1 parent 4a12bad commit 68952b8
Showing 1 changed file with 51 additions and 30 deletions.
81 changes: 51 additions & 30 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,38 +22,59 @@ jobs:
deploy-linux:
name: Build wheels for Linux
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for PyPI trusted publishing
id-token: write
steps:
- uses: actions/checkout@v4
# ATTENTION: set CIBW_ENVIRONMENT=GITLAB_AUTH=username:token in your repository secrets
- name: Build wheels
env:
CIBW_ENVIRONMENT: ${{ secrets.CIBW_ENVIRONMENT }}
uses: pypa/[email protected]
# ATTENTION: this step is mandatory for PyPI trusted publishing
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
packages-dir: wheelhouse/
deploy-macos: # WITHOUT testing
- uses: actions/checkout@v4
- name: Build wheels for Linux
env:
CIBW_ENVIRONMENT: ${{ secrets.CIBW_ENVIRONMENT }}
uses: pypa/[email protected]
- name: Upload Linux wheels as artifact
uses: actions/upload-artifact@v4
with:
name: linux-wheels
path: wheelhouse/
retention-days: 1

deploy-macos:
name: Build wheels for macOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Build wheels for macOS
env:
CIBW_ENVIRONMENT: ${{ secrets.CIBW_ENVIRONMENT }}
uses: pypa/[email protected]
- name: Upload macOS wheels as artifact
uses: actions/upload-artifact@v4
with:
name: macos-wheels
path: wheelhouse/
retention-days: 1

publish:
name: Publish wheels to PyPI
runs-on: ubuntu-latest
needs: [deploy-linux, deploy-macos]
permissions:
# IMPORTANT: this permission is mandatory for PyPI trusted publishing
id-token: write
id-token: write # Required for PyPI trusted publishing
steps:
- uses: actions/checkout@v4
# ATTENTION: set CIBW_ENVIRONMENT=GITLAB_AUTH=username:token in your repository secrets
- name: Build wheels
env:
CIBW_ENVIRONMENT: ${{ secrets.CIBW_ENVIRONMENT }}
uses: pypa/[email protected]
# ATTENTION: this step is mandatory for PyPI trusted publishing
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
packages-dir: wheelhouse/
- name: Download Linux wheels
uses: actions/download-artifact@v4
with:
name: linux-wheels
path: linux-wheels
- name: Download macOS wheels
uses: actions/download-artifact@v4
with:
name: macos-wheels
path: macos-wheels
- name: Combine wheels into a single directory
run: |
mkdir -p wheelhouse
cp linux-wheels/*.whl wheelhouse/
cp macos-wheels/*.whl wheelhouse/
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
packages-dir: wheelhouse/

0 comments on commit 68952b8

Please sign in to comment.