Skip to content

Commit 0561842

Browse files
committed
fix: prefer budiling note within workflows
1 parent 2b4910e commit 0561842

File tree

1 file changed

+43
-33
lines changed

1 file changed

+43
-33
lines changed

.github/workflows/deploy-to-huggingface.yml

Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,52 +5,62 @@ on:
55
branches: [ main ]
66
workflow_dispatch:
77

8+
env:
9+
OMP_NUM_THREADS: 8
10+
MKL_NUM_THREADS: 8
11+
812
jobs:
9-
build-and-deploy:
10-
runs-on: ubuntu-latest
13+
build-and-deploy-gpu:
14+
name: Build & Deploy (GPU)
15+
runs-on:
16+
group: aws-g6e-4xlarge
17+
18+
container:
19+
image: pytorch/pytorch:2.3.1-cuda12.1-cudnn8-runtime
20+
options: --gpus all --ipc host --shm-size "16gb"
21+
1122
steps:
1223
- name: Checkout
1324
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 2
27+
28+
- name: Show NVIDIA GPUs
29+
run: |
30+
nvidia-smi || true
31+
32+
- name: System deps (git, curl, etc.)
33+
run: |
34+
apt-get update
35+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
36+
git curl ca-certificates build-essential
37+
rm -rf /var/lib/apt/lists/*
1438
1539
- name: Install uv
1640
uses: astral-sh/setup-uv@v3
1741
with:
18-
version: "latest"
42+
version: latest
43+
44+
- name: Prepare Python 3.11
45+
run: |
46+
uv python install 3.11
47+
echo "UV_PYTHON=3.11" >> "$GITHUB_ENV"
48+
49+
- name: Build site with uvnote (GPU available)
50+
run: |
51+
# If your build uses CUDA, it will see the GPUs here.
52+
uvx https://github.com/drbh/uvnote.git build .
1953
20-
- name: Deploy via HF Job
54+
- name: Deploy to Hugging Face Space
2155
env:
2256
HF_TOKEN: ${{ secrets.HF_TOKEN }}
2357
run: |
24-
# Create secrets file for HF job
25-
echo "HF_TOKEN=$HF_TOKEN" > .sec
26-
27-
# Run uvnote build on GPU-enabled HF job and deploy
28-
uvx --from huggingface-hub \
29-
hf jobs run \
30-
--secrets-file .sec \
31-
--flavor a10g-largex4 \
32-
ghcr.io/astral-sh/uv:debian \
33-
/bin/bash -c \
34-
"
35-
# Install Python 3.11 and set as default
36-
uv python install 3.11 && \
37-
export UV_PYTHON=3.11 && \
38-
39-
# Clone the repository
40-
git clone https://github.com/${{ github.repository }}.git repo && \
41-
cd repo && \
42-
43-
# Build the uvnote site
44-
uvx https://github.com/drbh/uvnote.git build . && \
45-
46-
# Deploy to Hugging Face Space
47-
uvx --from huggingface-hub \
48-
hf upload \
49-
--token \$HF_TOKEN \
58+
# Upload the built site/ directory to the Space, cleaning removed files
59+
uvx --from huggingface-hub hf upload \
60+
--token "$HF_TOKEN" \
5061
--delete \
51-
--exclude \"*.json\" \
52-
--exclude \"*.pt\" \
62+
--exclude "*.json" \
63+
--exclude "*.pt" \
5364
--repo-type space \
5465
drbh/uvnote-book-explore \
5566
site/ /
56-
"

0 commit comments

Comments
 (0)