-
Notifications
You must be signed in to change notification settings - Fork 7k
72 lines (60 loc) · 2.11 KB
/
pypi_publish.yaml
File metadata and controls
72 lines (60 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: PyPI release
on:
workflow_dispatch:
push:
tags:
- "v*"
jobs:
build-and-test:
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.10"
- name: Fetch and checkout latest release branch
run: |
pip install -U requests packaging
LATEST_BRANCH=$(python utils/fetch_latest_release_branch.py)
echo "Latest branch: $LATEST_BRANCH"
git fetch origin "$LATEST_BRANCH"
git checkout "$LATEST_BRANCH"
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install -U build
pip install -U torch --index-url https://download.pytorch.org/whl/cpu
- name: Build the dist files
run: python -m build
- name: Install from built wheel
run: pip install dist/*.whl
- name: Test installing diffusers and importing
run: |
pip install -U transformers
python utils/print_env.py
python -c "from diffusers import __version__; print(__version__)"
python -c "from diffusers import DiffusionPipeline; pipe = DiffusionPipeline.from_pretrained('fusing/unet-ldm-dummy-update'); pipe()"
python -c "from diffusers import DiffusionPipeline; pipe = DiffusionPipeline.from_pretrained('hf-internal-testing/tiny-stable-diffusion-pipe', safety_checker=None); pipe('ah suh du')"
python -c "from diffusers import *"
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: python-dist
path: dist/
publish-to-pypi:
needs: build-and-test
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-22.04
environment: pypi-release
permissions:
id-token: write
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: python-dist
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1