Commit 5159847
On-Demand Nightly PyPI Publishing (#216)
Summary:
This PR implements on-demand nightly publishing for the tritonparse package. Instead of publishing a new nightly version every day regardless of changes, the workflow now checks if there are new commits since the last nightly release and skips publishing if there are none.
## Changes
### New File: `.github/scripts/check_new_commits.sh`
A standalone script that:
1. Queries PyPI API to get the latest nightly version (e.g., `0.3.2.dev20251208071617`)
2. Extracts the timestamp from the version string
3. Uses `git log --since` to check for new commits after that timestamp
4. Outputs `should_publish=true/false` to `GITHUB_OUTPUT`
Key features:
- **Network retry mechanism**: 3 retries with 5s delay between attempts
- **Fail-open design**: If PyPI API is unreachable, proceeds with publish (never blocks releases due to network issues)
- **Edge case handling**: Handles first nightly release, unparseable versions, etc.
### Modified: `.github/workflows/nightly-pypi.yml`
- Added a new step to run `check_new_commits.sh` before computing the nightly version
- All subsequent steps (build, check, publish) are conditioned on `should_publish != 'false'`
- Tag-based releases bypass the check entirely
## Workflow Logic
```
Trigger (schedule/workflow_dispatch/tag)
│
▼
Is tag push? ───Yes──► Build and Publish directly
│
No
▼
Run check_new_commits.sh
│
▼
Has new commits? ───No──► Skip (exit early)
│
Yes
▼
Compute version → Build → Publish
```
## Benefits
- **Reduces noise**: No more daily releases with identical content
- **Saves resources**: Skips unnecessary CI builds
- **Cleaner PyPI history**: Only releases with actual changes
- **Robust**: Network failures don't block legitimate releases
## Testing
Run locally with:
```bash
cd tritonparse_oss
GITHUB_OUTPUT=/tmp/gh_output.txt bash .github/scripts/check_new_commits.sh
cat /tmp/gh_output.txt
```
Pull Request resolved: #216
Reviewed By: xuzhao9
Differential Revision: D88696841
Pulled By: FindHao
fbshipit-source-id: 04e2ff74fc7cfa1fda2769e5a0fdaa975988c9641 parent c209bb9 commit 5159847
File tree
2 files changed
+125
-2
lines changed- .github
- scripts
- workflows
2 files changed
+125
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
26 | 32 | | |
27 | 33 | | |
28 | | - | |
| 34 | + | |
29 | 35 | | |
30 | 36 | | |
31 | 37 | | |
| |||
46 | 52 | | |
47 | 53 | | |
48 | 54 | | |
| 55 | + | |
49 | 56 | | |
50 | 57 | | |
51 | 58 | | |
| |||
55 | 62 | | |
56 | 63 | | |
57 | 64 | | |
| 65 | + | |
58 | 66 | | |
59 | 67 | | |
60 | 68 | | |
61 | 69 | | |
62 | 70 | | |
63 | | - | |
| 71 | + | |
64 | 72 | | |
65 | 73 | | |
66 | 74 | | |
| |||
0 commit comments