|
| 1 | +name: PR wheel preview deploy |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_run: |
| 5 | + workflows: ["PR wheel preview build"] |
| 6 | + types: |
| 7 | + - completed |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: pr-wheel-deploy-${{ github.event.workflow_run.head_sha }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + deploy: |
| 15 | + if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' |
| 16 | + runs-on: ubuntu-latest |
| 17 | + permissions: |
| 18 | + actions: read |
| 19 | + outputs: |
| 20 | + pr_number: ${{ steps.meta.outputs.pr_number }} |
| 21 | + sha: ${{ steps.meta.outputs.sha }} |
| 22 | + wheel_basename: ${{ steps.meta.outputs.wheel_basename }} |
| 23 | + steps: |
| 24 | + - name: Download metadata |
| 25 | + uses: actions/download-artifact@v4 |
| 26 | + with: |
| 27 | + name: pr-wheel-preview-metadata |
| 28 | + path: metadata |
| 29 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 30 | + repository: ${{ github.repository }} |
| 31 | + run-id: ${{ github.event.workflow_run.id }} |
| 32 | + |
| 33 | + - name: Download wheel |
| 34 | + uses: actions/download-artifact@v4 |
| 35 | + with: |
| 36 | + name: trackio-wheel |
| 37 | + path: wheel |
| 38 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 39 | + repository: ${{ github.repository }} |
| 40 | + run-id: ${{ github.event.workflow_run.id }} |
| 41 | + |
| 42 | + - name: Parse metadata |
| 43 | + id: meta |
| 44 | + run: | |
| 45 | + echo "pr_number=$(jq -r .pr_number metadata/output.json)" >> $GITHUB_OUTPUT |
| 46 | + echo "sha=$(jq -r .sha metadata/output.json)" >> $GITHUB_OUTPUT |
| 47 | + echo "wheel_basename=$(jq -r .wheel_basename metadata/output.json)" >> $GITHUB_OUTPUT |
| 48 | +
|
| 49 | + - name: Install hf CLI |
| 50 | + run: curl -LsSf https://hf.co/cli/install.sh | bash |
| 51 | + |
| 52 | + - name: Upload wheel to Hugging Face bucket |
| 53 | + env: |
| 54 | + HF_TOKEN: ${{ secrets.HF_PYPI_PREVIEWS_TOKEN }} |
| 55 | + run: | |
| 56 | + echo "$HOME/.local/bin" >> $GITHUB_PATH |
| 57 | + wheel_file=$(find wheel -maxdepth 1 -type f -name "*.whl" -print -quit) |
| 58 | + hf buckets cp "$wheel_file" "hf://buckets/trackio/trackio-wheels/${{ steps.meta.outputs.sha }}/" |
| 59 | +
|
| 60 | + comment: |
| 61 | + needs: deploy |
| 62 | + if: needs.deploy.result == 'success' |
| 63 | + uses: ./.github/workflows/comment-queue.yml |
| 64 | + secrets: |
| 65 | + gh_token: ${{ secrets.COMMENT_BOT_TOKEN }} |
| 66 | + with: |
| 67 | + pr_number: ${{ needs.deploy.outputs.pr_number }} |
| 68 | + tag: trackio-pr-wheel |
| 69 | + message: trackio-wheel~success~null |
| 70 | + additional_text: | |
| 71 | + **Install Trackio from this PR (includes built frontend)** |
| 72 | +
|
| 73 | + ```bash |
| 74 | + pip install "https://huggingface.co/buckets/trackio/trackio-wheels/resolve/${{ needs.deploy.outputs.sha }}/${{ needs.deploy.outputs.wheel_basename }}" |
| 75 | + ``` |
0 commit comments