Skip to content

Commit

Permalink
[Package] Upload-then-download for Win/Mac (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterJH5574 authored Nov 18, 2024
1 parent 50f87a5 commit a2db84f
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 10 deletions.
30 changes: 25 additions & 5 deletions .github/workflows/wheel_mac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ jobs:
platform: ['macos-13', 'macos-latest']

runs-on: ${{ matrix.platform }}
environment:
name: pypi
url: https://pypi.org/p/xgrammar
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
defaults:
run:
shell: 'bash -l {0}'
Expand Down Expand Up @@ -101,6 +96,31 @@ jobs:
python -m pip install setuptools Cython wheel
cd python
python setup.py bdist_wheel
- uses: actions/upload-artifact@v4
with:
name: xgrammar-wheel-${{ matrix.platform }}
path: python/dist/
retention-days: 3
overwrite: true

Publish-to-PyPI:
needs:
- Build
runs-on: ubuntu-latest

environment:
name: pypi
url: https://pypi.org/p/xgrammar
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the wheels
uses: actions/download-artifact@v4
with:
pattern: xgrammar-wheel-macos-*
path: python/dist/
merge-multiple: true
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
29 changes: 24 additions & 5 deletions .github/workflows/wheel_windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ on:
jobs:
Build:
runs-on: windows-latest
environment:
name: pypi
url: https://pypi.org/p/xgrammar
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
defaults:
run:
shell: 'cmd /C call {0}'
Expand Down Expand Up @@ -100,6 +95,30 @@ jobs:
python -m pip install setuptools Cython wheel
cd python
python setup.py bdist_wheel
- uses: actions/upload-artifact@v4
with:
name: xgrammar-wheel-windows
path: python/dist/
retention-days: 3
overwrite: true

Publish-to-PyPI:
needs:
- Build
runs-on: ubuntu-latest

environment:
name: pypi
url: https://pypi.org/p/xgrammar
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the wheels
uses: actions/download-artifact@v4
with:
name: xgrammar-wheel-windows
path: python/dist/
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down

0 comments on commit a2db84f

Please sign in to comment.