Skip to content
Open
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
102 changes: 102 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Build and release on PyPI and GitHub

on:
push:
tags:
- 'v*'

jobs:
build:
name: Build Distribution
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
persist-credentials: false
fetch-depth: 0 # workaround for https://github.com/ofek/hatch-vcs/issues/72
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Install build dependencies
run: python3 -m pip install build --user
- name: Build sdist and wheel
run: python -m build
- name: Upload distribution artifacts
uses: actions/upload-artifact@v7
with:
name: python-package-distributions
path: dist/

publish-pypi:
name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest
environment:
name: pypi-release # configure to require manual approval
url: https://pypi.org/p/salem
permissions:
id-token: write # for OIDC
steps:
- name: Download distribution artifacts
uses: actions/download-artifact@v8
with:
name: python-package-distributions
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

publish-testpypi:
name: Publish to TestPyPI
needs: build
runs-on: ubuntu-latest
environment:
name: testpypi-release
url: https://test.pypi.org/p/salem
permissions:
id-token: write
steps:
- name: Download distribution artifacts
uses: actions/download-artifact@v8
with:
name: python-package-distributions
path: dist/
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

publish-release:
name: Publish GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
needs: [build, publish-pypi] # do not release if PyPI upload fails
runs-on: ubuntu-latest
environment:
name: release
url: ${{ format('https://github.com/{0}/releases/tag/{1}', github.repository, github.ref_name) }}
permissions:
contents: write # required to create/edit releases
outputs:
release-id: ${{ steps.create-release.outputs.id }}
upload-url: ${{ steps.create-release.outputs.upload_url }}
steps:
- name: Download distribution artifacts
uses: actions/download-artifact@v8
with:
name: python-package-distributions
path: dist/
- name: Extract version from tag
id: version
run: echo "version=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
- name: Create and publish release
id: create-release
run: >
gh release create ${{ steps.version.outputs.version }}
--target master --verify-tag --generate-notes
--title "${{ steps.version.outputs.version }}"
--notes "A minor release of the salem package to fix deprecation warnings and a few bugs."
--repo ${{ github.repository }} ./dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
120 changes: 67 additions & 53 deletions HOWTO_RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,74 @@
How to issue a salem release.

1. Ensure your master branch is synced to upstream:

git pull upstream master

2. Look over whats-new.rst and the docs. Make sure "What's New" is complete
(check the date!) and add a brief summary note describing the release at the
top.
Prerequisites
-------------

You must set up the corresponding publisher on PyPI and TestPyPI.
The settings are:
Project name: salem
Owner: fmaussion
Repository name: salem
Workflow name: create-release.yml
Environment name: pypi-release

In Github, under Settings -> Environments, create an environment named
"pypi-release", and click "configure environment". Add a required reviewer.
These should be restricted to highly-trusted contributors to salem, as it
grants the power to publish on PyPI.

*IMPORTANT*
The workflow and environment names on PyPI and GitHub should be identical,
including the file extension (yml, not yaml).

Release steps
-------------

1. Go to your local main repository (not the fork) and ensure your master branch
is synced.
```
git fetch --all
git checkout master
git pull upstream master
```
2. Check whats-new.rst and the docs.
- Make sure "What's New" is complete (check the date!)
- Add a brief summary note describing the release at the top.
- Check index.rst and update the version.
3. If you have any doubts, run the full test suite one final time!

pytest --mpl .

4. On the master branch, commit the release in git:

git commit -a -m 'Release v0.X.Y'

5. Tag the release:

git tag -a v0.X.Y -m 'v0.X.Y'

6. Build source and binary wheels for pypi:

git clean -xdf # this deletes all uncommited changes!
python setup.py bdist_wheel sdist

7. Use twine to register and upload the release on pypi. Be careful, you can't take this back!

twine upload dist/salem-0.X.Y*

You will need to be listed as a package owner at
https://pypi.python.org/pypi/salem for this to work.
8. Push your changes to master:

git push origin master
git push origin --tags

9. Update the stable branch (used by ReadTheDocs) and switch back to master:

git checkout stable
git rebase master
git push origin stable
git checkout master

It's OK to force push to 'stable' if necessary.
We also update the stable branch with `git cherrypick` for documentation
only fixes that apply the current released version.
10. Add a section for the next release (`v.X.(Y+1)`) to `doc/whats-new.rst`.
11. Commit your changes and push to master again:

git commit -a -m 'Revert to dev version'
git push origin master

12. Issue the release on GitHub. Click on "Draft a new release" at
``pytest --run-slow --mpl .``
4. On the master branch, commit the release in git.
```
git commit -a -m 'Release v0.X.Y'
```
5. Tag the release and push to Github.
```
git tag -a v1.X.Y -m 'v1.X.Y'
git push origin tag v1.X.Y
```
7. Go to https://github.com/fmaussion/salem/actions and approve the release.
**This is the final step, you cannot take this back!** The release will be
built and published to PyPI and GitHub Releases automatically. You can
monitor the progress in the Actions tab of the repository.
8. Update the stable branch (used by ReadTheDocs) and switch back to master:
```
git checkout stable
git rebase master
git push origin stable
git checkout master
```
It's OK to force push to 'stable' if necessary. We also update the stable
branch with `git cherrypick` for documentation-only fixes that apply to
the current released version.
9. Add a section for the next release (`v.X.(Y+1)`) to `doc/whats-new.rst`.
10. Commit your changes and push to master again:
```
git commit -a -m 'Revert to dev version'
git push origin master
```
11. Issue the release on GitHub. Click on "Draft a new release" at
https://github.com/fmaussion/salem/releases. Type in the version number, but
don't bother to describe it -- we maintain that on the docs instead.
13. Update the docs. Login to https://readthedocs.org/projects/salem/versions/
12. Update the docs. Login to https://readthedocs.org/projects/salem/versions/
and switch your new release tag (at the bottom) from "Inactive" to "Active".
It should now build automatically.
14. Issue the release announcement!
13. Issue the release announcement!
4 changes: 2 additions & 2 deletions ci/requirements-py310-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ channels:
- conda-forge
dependencies:
- python=3.10
- numpy
- numpy>=2.0
- scipy
- pyproj
- joblib
- netCDF4
- shapely
- geopandas
- rasterio
- pandas
- pandas>=2.0
- xarray
- dask
- matplotlib
Expand Down
4 changes: 2 additions & 2 deletions ci/requirements-py311-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ channels:
- conda-forge
dependencies:
- python=3.11
- numpy
- numpy>=2.0
- scipy
- pyproj
- joblib
- netCDF4
- shapely
- geopandas
- rasterio
- pandas
- pandas>=2.0
- xarray
- dask
- matplotlib
Expand Down
4 changes: 2 additions & 2 deletions ci/requirements-py311-min.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ channels:
- conda-forge
dependencies:
- python=3.11
- numpy
- numpy>=2.0
- scipy
- pyproj
- joblib
- netCDF4
- pandas
- pandas>=2.0
- xarray
- pip
- pip:
Expand Down
4 changes: 2 additions & 2 deletions ci/requirements-py311-xr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ channels:
- conda-forge
dependencies:
- python=3.11
- numpy
- numpy>=2.0
- scipy
- pyproj
- joblib
- netCDF4
- pandas
- pandas>=2.0
- xarray
- dask
- pip
Expand Down
4 changes: 2 additions & 2 deletions ci/requirements-py312-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ channels:
- conda-forge
dependencies:
- python=3.12
- numpy
- numpy>=2.0
- scipy
- pyproj
- joblib
- netCDF4
- shapely
- geopandas
- rasterio
- pandas
- pandas>=2.0
- xarray
- dask
- matplotlib
Expand Down
4 changes: 2 additions & 2 deletions ci/requirements-py313-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ channels:
- conda-forge
dependencies:
- python=3.13
- numpy
- numpy>=2.0
- scipy
- pyproj
- joblib
- netCDF4
- shapely
- geopandas
- rasterio
- pandas
- pandas>=2.0
- xarray
- dask
- matplotlib
Expand Down
4 changes: 2 additions & 2 deletions ci/requirements-py314-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ channels:
- conda-forge
dependencies:
- python=3.14
- numpy
- numpy>=2.0
- scipy
- pyproj
- joblib
- netCDF4
- shapely
- geopandas
- rasterio
- pandas
- pandas>=2.0
- xarray
- dask
- matplotlib
Expand Down
4 changes: 2 additions & 2 deletions docs/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ dependencies:
- ipykernel
- ipython
- netcdf4
- numpy
- numpy>=2.0
- numpydoc
- pandas
- pandas>=2.0
- rasterio
- sphinx
- matplotlib
Expand Down
6 changes: 6 additions & 0 deletions docs/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@ What's New

v0.3.x (Unreleased)
-------------------
A minor release of the salem package to fix a few deprecation warnings and
update packaging:

- update CI workflow to automatically build and publish new salem releases (:pull:`260`).
By `Nicolas Gampierakis <https://github.com/gampnico>`_).
- address deprecations, including dropping support for numpy and pandas below
versions 2.0 (:pull:`259`).
By `Nicolas Gampierakis <https://github.com/gampnico>`_).

v0.3.11 (12 July 2024)
----------------------
Expand Down
Loading
Loading