From 4e9c0e51ca0c1f19829ca517717cab76cdfa3207 Mon Sep 17 00:00:00 2001 From: LoserCheems <3314685395@qq.com> Date: Wed, 10 Sep 2025 18:08:02 +0800 Subject: [PATCH] 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. --- .github/workflows/manual_publish.yml | 54 ++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/manual_publish.yml diff --git a/.github/workflows/manual_publish.yml b/.github/workflows/manual_publish.yml new file mode 100644 index 0000000..c1dae8e --- /dev/null +++ b/.github/workflows/manual_publish.yml @@ -0,0 +1,54 @@ +name: Manual publish to PyPI + +on: + workflow_dispatch: + inputs: + tag: + description: Git tag to publish + required: true + type: string + python-version: + description: Python version to use for build + required: false + default: '3.10' + type: string + +jobs: + publish_package: + name: Publish package + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ inputs.tag }} + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ inputs.python-version }} + + - name: Install dependencies + run: | + pip install ninja packaging wheel twine + pip install setuptools==75.8.0 + pip install torch --index-url https://download.pytorch.org/whl/cpu + + - name: Build core package + env: + FLASH_DMATTN_SKIP_CUDA_BUILD: "TRUE" + run: | + python setup.py sdist --dist-dir=dist + ls -l dist + + - name: Deploy + env: + TWINE_USERNAME: "__token__" + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + run: | + if [ -z "$TWINE_PASSWORD" ]; then + echo "::error::PYPI_API_TOKEN secret not set; aborting publish."; exit 1 + fi + python -m twine upload dist/*