Skip to content

Commit 4e9c0e5

Browse files
committed
Adds manual PyPI publishing workflow
Enables on-demand package publishing to PyPI through GitHub Actions workflow dispatch. Accepts configurable git tag and Python version inputs, builds source distribution with CUDA build skipped, and uploads to PyPI using API token authentication. Includes validation to prevent publishing when required secrets are missing.
1 parent 15c6a2d commit 4e9c0e5

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Manual publish to PyPI
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: Git tag to publish
8+
required: true
9+
type: string
10+
python-version:
11+
description: Python version to use for build
12+
required: false
13+
default: '3.10'
14+
type: string
15+
16+
jobs:
17+
publish_package:
18+
name: Publish package
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
with:
26+
ref: ${{ inputs.tag }}
27+
28+
- name: Set up Python
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: ${{ inputs.python-version }}
32+
33+
- name: Install dependencies
34+
run: |
35+
pip install ninja packaging wheel twine
36+
pip install setuptools==75.8.0
37+
pip install torch --index-url https://download.pytorch.org/whl/cpu
38+
39+
- name: Build core package
40+
env:
41+
FLASH_DMATTN_SKIP_CUDA_BUILD: "TRUE"
42+
run: |
43+
python setup.py sdist --dist-dir=dist
44+
ls -l dist
45+
46+
- name: Deploy
47+
env:
48+
TWINE_USERNAME: "__token__"
49+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
50+
run: |
51+
if [ -z "$TWINE_PASSWORD" ]; then
52+
echo "::error::PYPI_API_TOKEN secret not set; aborting publish."; exit 1
53+
fi
54+
python -m twine upload dist/*

0 commit comments

Comments
 (0)