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
134 changes: 134 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Release

# One release pipeline (roadmap D6). Publishing a GitHub Release is the only manual step:
#
# 1. build: build the wheel and sdist from the tagged commit, run
# scripts/release/check_release.py (tag = v<version>, dated CHANGELOG section, docs
# badge, wheel contents: G-011, G-012, G-032), and install the wheel in a clean venv.
# 2. pypi: upload to PyPI with Trusted Publishing (OIDC, no token anywhere). Needs the
# trusted publisher set up on pypi.org once (see RELEASING.md).
# 3. release-files: attach the wheel and sdist to the GitHub Release, and fill in its
# notes from CHANGELOG.md if they were left empty.
#
# desktop-builds.yml attaches the desktop installers on the same event, and docs.yml has
# already deployed the website when the release PR was merged.
#
# On a pull request that touches packaging, or run by hand (Actions → Release → Run
# workflow), it is a dry run: build and check only.
on:
release:
types: [published]
# Dry run (build and check only) when the packaging or this pipeline changes.
pull_request:
paths:
- "pyproject.toml"
- "scripts/release/**"
- ".github/workflows/release.yml"
workflow_dispatch:

permissions:
contents: read

concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false

jobs:
build:
name: Build and check
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7

- uses: actions/setup-python@v7
with:
python-version: "3.12"

- name: Build the wheel and sdist
run: |
python -m pip install --upgrade pip build
python -m build

- name: Check the release
env:
TAG: ${{ github.event.release.tag_name }}
run: |
python scripts/release/check_release.py --dist dist --notes build/release-notes.md \
${TAG:+--tag "$TAG"}

- name: Install the wheel in a clean environment
run: |
python -m venv /tmp/clean
/tmp/clean/bin/pip install dist/*.whl
cd /tmp
/tmp/clean/bin/eagleplot --version
/tmp/clean/bin/python -I -c "
import eagleplot, pathlib
from eagleplot.io import load_data
root = pathlib.Path(eagleplot.__file__).parent
data = load_data(str(root / 'example-data' / 'Artificial' / 'sine_cosine_waves.csv'))
assert data.shape[0] > 0, data.shape
print('EaglePlot', eagleplot.__version__, 'installed from the wheel and loads data')
"

- uses: actions/upload-artifact@v7
with:
name: release-dist
path: |
dist/
build/release-notes.md
if-no-files-found: error

pypi:
name: Publish to PyPI
needs: build
if: github.event_name == 'release'
runs-on: ubuntu-24.04
environment:
name: pypi
url: https://pypi.org/project/eagleplot/
permissions:
id-token: write # Trusted Publishing: PyPI accepts this job's identity, no token
steps:
- uses: actions/download-artifact@v8
with:
name: release-dist

- uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
# A version already on PyPI (e.g. uploaded by hand) is left alone, not an error.
skip-existing: true

release-files:
name: Attach files and notes to the release
needs: build
if: github.event_name == 'release'
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- uses: actions/download-artifact@v8
with:
name: release-dist

- name: Attach the wheel and sdist
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
TAG: ${{ github.event.release.tag_name }}
run: gh release upload "$TAG" dist/* --clobber

- name: Fill in empty release notes from CHANGELOG.md
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
TAG: ${{ github.event.release.tag_name }}
run: |
body=$(gh release view "$TAG" --json body --jq .body)
if [ -z "${body//[[:space:]]/}" ]; then
gh release edit "$TAG" --notes-file build/release-notes.md
echo "Release notes filled in from CHANGELOG.md"
else
echo "Release notes already written; left as they are"
fi
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## [Unreleased]

### Added

- **Releases are published by GitHub Actions** (`.github/workflows/release.yml`). Publishing
a GitHub Release builds the package from the tag, checks it, uploads it to PyPI (Trusted
Publishing, no stored token), attaches the files and installers to the release, and fills
in the release notes from this changelog. How to make a release: `RELEASING.md`.
- **The Download page compares the three versions** (web app, desktop app, Python package):
install, download size, offline use, speed, folders, NIST and the Python API.

### Changed

- The Download page no longer has a code signing policy for the SignPath Foundation (the
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ MPLBACKEND=Agg pytest tests/
- **Follow the conventions of the module you are editing**, and give public functions a
NumPy-style docstring with Parameters and Returns sections.
- **Update `CHANGELOG.md`** under `## [Unreleased]` for anything a user would notice.
- Releases are made by the maintainers: see [RELEASING.md](RELEASING.md).

## Pull requests

Expand Down
71 changes: 71 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Releasing EaglePlot

A release is one pull request and one button. Everything else runs in GitHub Actions:

| Workflow | On a published release it… |
| --- | --- |
| [`release.yml`](.github/workflows/release.yml) | builds the wheel and sdist from the tag, checks them ([`scripts/release/check_release.py`](scripts/release/check_release.py)), uploads them to PyPI (Trusted Publishing: no token), attaches them to the release, and fills in empty release notes from `CHANGELOG.md` |
| [`desktop-builds.yml`](.github/workflows/desktop-builds.yml) | builds the Windows, macOS and Linux installers and attaches them (about 15 minutes) |
| [`docs.yml`](.github/workflows/docs.yml) | already deployed the website and web app when the release PR was merged |

## 1. The release pull request

On a branch:

1. `eagleplot/__init__.py`: set `__version__` to the new version ([semver](https://semver.org/)).
2. `docs/index.html`: the version badge (`nav__badge`) shows the same version.
3. `CHANGELOG.md`: rename `## [Unreleased]` to `## [X.Y.Z] - YYYY-MM-DD` (add a short
summary paragraph), start a new empty `## [Unreleased]` above it, and update the compare
links at the end (`[Unreleased]` → `vX.Y.Z...HEAD`, new `[X.Y.Z]` → `vPREVIOUS...vX.Y.Z`).
4. Check it:

```bash
python scripts/release/check_release.py --tag vX.Y.Z
python -m build && python scripts/release/check_release.py --tag vX.Y.Z --dist dist
```

Optionally run **Actions → Release → Run workflow** on the branch: a dry run that builds,
checks and installs the wheel without publishing anything.
5. Open the PR, wait for CI, merge.

## 2. Publish the GitHub Release

On GitHub: **Releases → Draft a new release**.

- **Choose a tag:** type `vX.Y.Z` and pick *Create new tag: vX.Y.Z on publish*. Target: `main`
(check that its latest commit is the release PR's merge).
- **Title:** `EaglePlot X.Y.Z`.
- **Notes:** leave empty to have them filled in from `CHANGELOG.md`, or write your own.
- Click **Publish release**. *Save draft* publishes nothing and starts nothing.

Then watch **Actions**: *Release* (about 2 minutes) and *Desktop builds* (about 15 minutes).
When both are green, the release page lists the wheel, the sdist and four installers, and
`pip install eagleplot==X.Y.Z` works.

## If something fails

- **The release check fails** (for example the tag doesn't match `__version__`): nothing has
been uploaded. Delete the release and its tag on GitHub, fix `main` with a PR, and publish
again.
- **PyPI upload fails:** re-run the failed job. A version already on PyPI is skipped, not
overwritten: PyPI never accepts the same version twice, so a broken upload needs a new
version (`X.Y.Z+1`).
- **A desktop installer fails:** re-run the failed job; it replaces the release's files.

## One-time setup (done once per project)

**PyPI Trusted Publishing.** On [pypi.org](https://pypi.org/manage/project/eagleplot/settings/publishing/),
*Publishing → Add a new publisher → GitHub*:

| Field | Value |
| --- | --- |
| Owner | `The-Schultz-Lab` |
| Repository name | `eagleplot` |
| Workflow name | `release.yml` |
| Environment name | `pypi` |

PyPI API tokens are then no longer needed for releases; delete any that were only used for
uploading.

**Optional:** in the repository's *Settings → Environments → pypi*, add yourself as a
required reviewer, so every PyPI upload waits for a click.
20 changes: 20 additions & 0 deletions docs/download.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,26 @@ There are three ways to use it. All three keep your data on your own computer.
| **Desktop app** | Using EaglePlot offline, without installing Python | Windows, macOS and Linux installers on the [Releases page](https://github.com/The-Schultz-Lab/eagleplot/releases) (from version 3.2.0) |
| **Python package** | Scripts, notebooks, and the full GUI | `pip install eagleplot` ([PyPI](https://pypi.org/project/eagleplot/)), then see [Getting Started](getting-started.html) |

## What each version can do

All three are the same EaglePlot, with the same pages and plots, from the same release.

| | Web app | Desktop app | Python package |
| --- | --- | --- | --- |
| Install | Nothing (or **Install** in Chrome/Edge) | Installer, no admin rights | Python 3.9+, `pip install eagleplot` |
| Download | About 45 MB on the first visit | About 190 MB | A few MB, plus its Python packages |
| Works offline | After one visit, once installed | Yes | Yes |
| Start-up | About 8 s | About 12 s | A few seconds |
| Speed of plots and fits | Slower (runs in WebAssembly) | Slower (runs in WebAssembly) | Full speed |
| Load a whole folder (Batch Import) | No | Yes | Yes |
| Fetch spectra from NIST | Links to NIST | Links to NIST | Yes (`pip install "eagleplot[nist]"`) |
| Change the app's theme | No | No | Yes |
| Python API, notebooks, `eagleplot` command | No | No | Yes |
| Settings and presets kept | In the browser | Yes | Yes |
| Data stays on your computer | Yes | Yes | Yes |

The version number is shown on the Home page of all three.

## Desktop app

Download the file for your system from the [latest release](https://github.com/The-Schultz-Lab/eagleplot/releases/latest):
Expand Down
Loading
Loading