Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 39 additions & 22 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,62 @@
name: Publish package to PyPI

on:
push:
tags:
- '*'
- "*"

jobs:
publish:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@master
- name: Set up Python 3.9
uses: actions/setup-python@v1
- name: Checkout
uses: actions/checkout@v4
with:
python-version: 3.9
fetch-depth: 0 # ensures full history/tags are available if you ever need them

- name: Set up Python 3.13
uses: actions/setup-python@v6
with:
python-version: "3.13"

- name: Get release version
shell: bash
run: |
echo "CHANGELOG_VERSION=$(cat CHANGELOG.md | grep -oP '(?<=###\s)(.*)(?=\s\-)' | head -n 1 | sed 's/Version\s/v/')" >> $GITHUB_ENV
echo "TAG_VERSION=`echo $(git describe --tags --abbrev=0)`" >> $GITHUB_ENV
echo "CHANGELOG_VERSION=$(grep -oP '(?<=###\s)(.*)(?=\s\-)' CHANGELOG.md | head -n 1 | sed 's/Version\s/v/')" >> "$GITHUB_ENV"
echo "TAG_VERSION=${GITHUB_REF_NAME}" >> "$GITHUB_ENV"

- name: Check changelog release version
if: ${{ env.TAG_VERSION != env.CHANGELOG_VERSION }}
shell: bash
run: |
echo "CHANGELOG_VERSION($CHANGELOG_VERSION) is different from TAG_VERSION($TAG_VERSION)"
exit 1
if [[ "${TAG_VERSION}" != "${CHANGELOG_VERSION}" ]]; then
echo "CHANGELOG_VERSION(${CHANGELOG_VERSION}) is different from TAG_VERSION(${TAG_VERSION})"
exit 1
fi

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Get all git tags
run: git fetch --tags -f

- name: Build package
run: |
python -m build --sdist --wheel
- name: Get package size
run: echo "PKG_SIZE=$(find dist -maxdepth 1 -regex '.*gz' | xargs stat --format='%s')" >> $GITHUB_ENV
- name: Check package size
if: ${{ env.PKG_SIZE > 1e+8 }}

- name: Check package size (100MB max)
shell: bash
run: |
echo "PKG_SIZE($PKG_SIZE bytes) is greater than 100MB"
exit 1
PKG_SIZE="$(find dist -maxdepth 1 -name '*.tar.gz' -print0 | xargs -0 stat --format='%s' | head -n 1)"
echo "PKG_SIZE=${PKG_SIZE}" >> "$GITHUB_ENV"
if [[ -n "${PKG_SIZE}" ]] && (( PKG_SIZE > 100000000 )); then
echo "PKG_SIZE(${PKG_SIZE} bytes) is greater than 100MB"
exit 1
fi

- name: Publish package
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
if: startsWith(github.ref, 'refs/tags/')
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip_existing: true
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
skip-existing: true
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
## Xarray-Spatial Changelog
-----------


### Version 0.5.1 - 2025-12-16
- updated runner, python setup action and checkout actions for PyPI publish


### Version 0.5.0 - 2025-12-15
- Python 3.14 is now supported!
- Fixed bug in curvature dask+cupy args and added unit test for curvature(#824)
Expand Down