-
Notifications
You must be signed in to change notification settings - Fork 16
executable file
·53 lines (51 loc) · 1.73 KB
/
Copy pathrelease_pypi.yml
File metadata and controls
executable file
·53 lines (51 loc) · 1.73 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
name: Release PyPI
on:
push:
tags:
- v*
workflow_dispatch:
jobs:
pypi:
name: Publish to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"
- name: Build
run: uv build
- name: Publish
run: uv publish
- name: Wait for PyPI availability and notify balatrollm
env:
BALATROLLM_TOKEN: ${{ secrets.BALATROLLM_TOKEN }}
run: |
VERSION="${GITHUB_REF_NAME#v}"
echo "Waiting for version $VERSION to appear on PyPI..."
# Poll PyPI until version is available (max 5 minutes)
for i in {1..30}; do
PYPI_VERSION=$(curl -s https://pypi.org/pypi/balatrobot/json | jq -r .info.version)
if [ "$PYPI_VERSION" = "$VERSION" ]; then
echo "✓ Version $VERSION is available on PyPI"
curl -s -X POST -H "Accept: application/vnd.github+json" \
-H "Authorization: token $BALATROLLM_TOKEN" \
https://api.github.com/repos/coder/balatrollm/dispatches \
-d "{\"event_type\":\"balatrobot_release\",\"client_payload\":{\"version\":\"$VERSION\"}}"
echo "✓ Dispatched to balatrollm"
exit 0
fi
echo "Attempt $i/30: PyPI shows $PYPI_VERSION, waiting for $VERSION..."
sleep 10
done
echo "ERROR: Version $VERSION not available on PyPI after 5 minutes"
exit 1