forked from ipython/ipython
-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (65 loc) · 2.25 KB
/
publish.yml
File metadata and controls
79 lines (65 loc) · 2.25 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
76
77
78
79
name: Build and Publish IPython
on:
push:
tags:
- '*'
workflow_dispatch:
jobs:
build-and-publish:
name: Build and Publish to PyPI
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/ipython
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.14"
cache: pip
cache-dependency-path: |
pyproject.toml
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build
- name: Build distribution
run: python -m build
- name: Verify built version matches tag
if: startsWith(github.ref, 'refs/tags/')
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
echo "Tag name: $TAG_NAME"
# Check dist folder filenames
echo "Built distribution files:"
ls -la dist/
# Install the built wheel
python -m pip install dist/*.whl
# Get IPython version
IPYTHON_VERSION=$(ipython --version)
echo "Installed IPython version: $IPYTHON_VERSION"
# Compare versions (allow only X.Y.Z)
if [[ "$TAG_NAME" != "$IPYTHON_VERSION" ]]; then
echo "Error: Tag ($TAG_NAME) does not match built IPython version ($IPYTHON_VERSION)"
exit 1
fi
echo "Version check passed! Tag matches built version."
- name: Publish distribution to PyPI
if: startsWith(github.ref, 'refs/tags/')
uses: pypa/gh-action-pypi-publish@v1.13.0
- name: Send Zulip notification
if: startsWith(github.ref, 'refs/tags/')
uses: zulip/github-actions-zulip/send-message@v1
with:
api-key: ${{ secrets.ZULIP_API_KEY }}
email: ${{ secrets.ZULIP_EMAIL }}
organization-url: ${{ vars.ZULIP_ORGANIZATION_URL }}
to: 'Releases'
type: 'stream'
topic: 'IPython'
content: |
IPython ${{ github.ref_name }} was just released on PyPI! 🎉
https://pypi.org/project/ipython/${{ github.ref_name }}/