-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Package] Add GitHub action package build workflow (#51)
This PR adds the CD workflow file, which will be triggered when a new tag is pushed.
- Loading branch information
1 parent
485ec04
commit 3ae4945
Showing
2 changed files
with
69 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# GH actions. | ||
name: Wheel-Manylinux | ||
|
||
|
||
on: push | ||
|
||
jobs: | ||
Build: | ||
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes | ||
strategy: | ||
matrix: | ||
config: | ||
- image: 'mlcaidev/package-cpu:254d630' | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Reclaim disk space | ||
run: | | ||
df -h | ||
sudo rm -rf /usr/local/lib/android | ||
sudo rm -rf /opt/hostedtoolcache/CodeQL | ||
sudo rm -rf /usr/local/.ghcup | ||
df -h | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: 'recursive' | ||
- name: Checkout source | ||
run: | | ||
git clone https://github.com/mlc-ai/package package --recursive | ||
- name: Setup script env | ||
run: | | ||
rm -rf conda | ||
ln -s package/3rdparty/tlcpack/conda conda | ||
- name: Sync XGrammar Package | ||
run: | | ||
python scripts/sync_package.py --package . --package-name xgrammar --version ${{ github.ref_name }} --skip-conda | ||
- name: Build XGrammar | ||
env: | ||
IMAGE: ${{ matrix.config.image }} | ||
run: | | ||
scripts/docker/bash.sh --no-gpu $IMAGE ./scripts/build_xgrammar_wheel_manylinux.sh | ||
Publish-to-PyPI: | ||
name: >- | ||
Upload release to PyPI | ||
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes | ||
needs: | ||
- Build | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://test.pypi.org/p/xgrammar-nightly | ||
permissions: | ||
id-token: write # IMPORTANT: mandatory for trusted publishing | ||
steps: | ||
- name: Retrieve all wheels | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distributions | ||
path: xgrammar/python/repaired_wheels/ | ||
- name: Publish package distributions to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters