Skip to content

Commit 273a8ef

Browse files
authored
updated runner, python setup action and checkout actions for PyPI publish (#826)
* updated runner, python setup action and checkout actions for PyPI publish * updated changelog for 0.5.1
1 parent a196844 commit 273a8ef

File tree

2 files changed

+44
-22
lines changed

2 files changed

+44
-22
lines changed

.github/workflows/pypi-publish.yml

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,62 @@
11
name: Publish package to PyPI
2+
23
on:
34
push:
45
tags:
5-
- '*'
6+
- "*"
7+
68
jobs:
79
publish:
8-
runs-on: ubuntu-20.04
10+
runs-on: ubuntu-22.04
11+
912
steps:
10-
- uses: actions/checkout@master
11-
- name: Set up Python 3.9
12-
uses: actions/setup-python@v1
13+
- name: Checkout
14+
uses: actions/checkout@v4
1315
with:
14-
python-version: 3.9
16+
fetch-depth: 0 # ensures full history/tags are available if you ever need them
17+
18+
- name: Set up Python 3.13
19+
uses: actions/setup-python@v6
20+
with:
21+
python-version: "3.13"
22+
1523
- name: Get release version
24+
shell: bash
1625
run: |
17-
echo "CHANGELOG_VERSION=$(cat CHANGELOG.md | grep -oP '(?<=###\s)(.*)(?=\s\-)' | head -n 1 | sed 's/Version\s/v/')" >> $GITHUB_ENV
18-
echo "TAG_VERSION=`echo $(git describe --tags --abbrev=0)`" >> $GITHUB_ENV
26+
echo "CHANGELOG_VERSION=$(grep -oP '(?<=###\s)(.*)(?=\s\-)' CHANGELOG.md | head -n 1 | sed 's/Version\s/v/')" >> "$GITHUB_ENV"
27+
echo "TAG_VERSION=${GITHUB_REF_NAME}" >> "$GITHUB_ENV"
28+
1929
- name: Check changelog release version
20-
if: ${{ env.TAG_VERSION != env.CHANGELOG_VERSION }}
30+
shell: bash
2131
run: |
22-
echo "CHANGELOG_VERSION($CHANGELOG_VERSION) is different from TAG_VERSION($TAG_VERSION)"
23-
exit 1
32+
if [[ "${TAG_VERSION}" != "${CHANGELOG_VERSION}" ]]; then
33+
echo "CHANGELOG_VERSION(${CHANGELOG_VERSION}) is different from TAG_VERSION(${TAG_VERSION})"
34+
exit 1
35+
fi
36+
2437
- name: Install dependencies
2538
run: |
2639
python -m pip install --upgrade pip
2740
pip install build
28-
- name: Get all git tags
29-
run: git fetch --tags -f
41+
3042
- name: Build package
3143
run: |
3244
python -m build --sdist --wheel
33-
- name: Get package size
34-
run: echo "PKG_SIZE=$(find dist -maxdepth 1 -regex '.*gz' | xargs stat --format='%s')" >> $GITHUB_ENV
35-
- name: Check package size
36-
if: ${{ env.PKG_SIZE > 1e+8 }}
45+
46+
- name: Check package size (100MB max)
47+
shell: bash
3748
run: |
38-
echo "PKG_SIZE($PKG_SIZE bytes) is greater than 100MB"
39-
exit 1
49+
PKG_SIZE="$(find dist -maxdepth 1 -name '*.tar.gz' -print0 | xargs -0 stat --format='%s' | head -n 1)"
50+
echo "PKG_SIZE=${PKG_SIZE}" >> "$GITHUB_ENV"
51+
if [[ -n "${PKG_SIZE}" ]] && (( PKG_SIZE > 100000000 )); then
52+
echo "PKG_SIZE(${PKG_SIZE} bytes) is greater than 100MB"
53+
exit 1
54+
fi
55+
4056
- name: Publish package
41-
if: startsWith(github.ref, 'refs/tags')
42-
uses: pypa/gh-action-pypi-publish@master
57+
if: startsWith(github.ref, 'refs/tags/')
58+
uses: pypa/gh-action-pypi-publish@release/v1
4359
with:
44-
skip_existing: true
60+
user: __token__
4561
password: ${{ secrets.PYPI_API_TOKEN }}
62+
skip-existing: true

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
## Xarray-Spatial Changelog
22
-----------
33

4+
5+
### Version 0.5.1 - 2025-12-16
6+
- updated runner, python setup action and checkout actions for PyPI publish
7+
8+
49
### Version 0.5.0 - 2025-12-15
510
- Python 3.14 is now supported!
611
- Fixed bug in curvature dask+cupy args and added unit test for curvature(#824)

0 commit comments

Comments
 (0)