-
Notifications
You must be signed in to change notification settings - Fork 112
75 lines (66 loc) · 2.65 KB
/
pr-wheel-preview-deploy.yml
File metadata and controls
75 lines (66 loc) · 2.65 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
73
74
75
name: PR wheel preview deploy
on:
workflow_run:
workflows: ["PR wheel preview build"]
types:
- completed
concurrency:
group: pr-wheel-deploy-${{ github.event.workflow_run.head_sha }}
cancel-in-progress: true
jobs:
deploy:
if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request'
runs-on: ubuntu-latest
permissions:
actions: read
outputs:
pr_number: ${{ steps.meta.outputs.pr_number }}
sha: ${{ steps.meta.outputs.sha }}
wheel_basename: ${{ steps.meta.outputs.wheel_basename }}
steps:
- name: Download metadata
uses: actions/download-artifact@v4
with:
name: pr-wheel-preview-metadata
path: metadata
github-token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
run-id: ${{ github.event.workflow_run.id }}
- name: Download wheel
uses: actions/download-artifact@v4
with:
name: trackio-wheel
path: wheel
github-token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
run-id: ${{ github.event.workflow_run.id }}
- name: Parse metadata
id: meta
run: |
echo "pr_number=$(jq -r .pr_number metadata/output.json)" >> $GITHUB_OUTPUT
echo "sha=$(jq -r .sha metadata/output.json)" >> $GITHUB_OUTPUT
echo "wheel_basename=$(jq -r .wheel_basename metadata/output.json)" >> $GITHUB_OUTPUT
- name: Install hf CLI
run: curl -LsSf https://hf.co/cli/install.sh | bash
- name: Upload wheel to Hugging Face bucket
env:
HF_TOKEN: ${{ secrets.HF_PYPI_PREVIEWS_TOKEN }}
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
wheel_file=$(find wheel -maxdepth 1 -type f -name "*.whl" -print -quit)
hf buckets cp "$wheel_file" "hf://buckets/trackio/trackio-wheels/${{ steps.meta.outputs.sha }}/"
comment:
needs: deploy
if: needs.deploy.result == 'success'
uses: ./.github/workflows/comment-queue.yml
secrets:
gh_token: ${{ secrets.COMMENT_BOT_TOKEN }}
with:
pr_number: ${{ needs.deploy.outputs.pr_number }}
tag: trackio-pr-wheel
message: spaces~success~https://huggingface.co/buckets/trackio/trackio-wheels/resolve/${{ needs.deploy.outputs.sha }}/${{ needs.deploy.outputs.wheel_basename }}
additional_text: |
**Install Trackio from this PR (includes built frontend)**
```bash
pip install "https://huggingface.co/buckets/trackio/trackio-wheels/resolve/${{ needs.deploy.outputs.sha }}/${{ needs.deploy.outputs.wheel_basename }}"
```