Skip to content

Commit fb728f2

Browse files
FBumannclaude
andauthored
ci: adopt blueprint release pipeline (#61)
* ci: adopt blueprint release pipeline - release.yaml: release-please on push to main, calls publish on release - publish.yaml: tag push + workflow_call, creates GitHub Release for manual tags - docs.yml: triggers after publish completes - Remove old release.yml and publish.yml Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(ci): gate github-release on publish and add idempotency check Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ci: add Read the Docs config with uv Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * build: move optional-dependencies to dependency-groups Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ci: use --group instead of --extra for dependency-groups Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ci: add publish concurrency group, clean up pr-title trigger Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a23df5c commit fb728f2

File tree

10 files changed

+110
-115
lines changed

10 files changed

+110
-115
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
run: uv python install ${{ matrix.python-version }}
2424

2525
- name: Install dependencies
26-
run: uv sync --extra dev
26+
run: uv sync --group dev
2727

2828
- name: Lint
2929
run: uv run ruff check .
@@ -53,7 +53,7 @@ jobs:
5353
uses: astral-sh/setup-uv@v7
5454

5555
- name: Install dependencies
56-
run: uv sync --extra docs
56+
run: uv sync --group docs
5757

5858
- name: Build docs
5959
run: uv run mkdocs build

.github/workflows/docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
branches: [main]
88
workflow_dispatch: # Manual trigger
99
workflow_run:
10-
workflows: ["Release (Manual)", "Release Please"]
10+
workflows: ["Publish"]
1111
types: [completed]
1212

1313
permissions:
@@ -32,7 +32,7 @@ jobs:
3232
uses: astral-sh/setup-uv@v7
3333

3434
- name: Install dependencies
35-
run: uv sync --extra docs
35+
run: uv sync --group docs
3636

3737
- name: Build docs
3838
run: uv run mkdocs build

.github/workflows/latest-deps.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
run: uv python install ${{ matrix.python-version }}
2626

2727
- name: Install with latest dependencies
28-
run: uv sync --extra dev --upgrade
28+
run: uv sync --group dev --upgrade
2929

3030
- name: Test
3131
run: uv run pytest --cov=xarray_plotly

.github/workflows/pr-title.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: PR Title Check
22

33
on:
44
pull_request:
5-
types: [opened, edited, synchronize, reopened]
5+
types: [opened, edited, reopened]
66

77
jobs:
88
validate:

.github/workflows/publish.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags: ["v*"]
6+
workflow_call:
7+
inputs:
8+
tag:
9+
required: true
10+
type: string
11+
12+
concurrency:
13+
group: publish-${{ inputs.tag || github.ref_name }}
14+
cancel-in-progress: false
15+
16+
permissions:
17+
contents: write
18+
id-token: write
19+
attestations: write
20+
21+
jobs:
22+
publish:
23+
name: Build & publish to PyPI
24+
runs-on: ubuntu-24.04
25+
timeout-minutes: 10
26+
environment:
27+
name: pypi
28+
url: https://pypi.org/project/xarray_plotly
29+
steps:
30+
- uses: actions/checkout@v4
31+
with:
32+
ref: ${{ inputs.tag || github.ref_name }}
33+
fetch-depth: 0
34+
35+
- uses: astral-sh/setup-uv@v7
36+
with:
37+
enable-cache: true
38+
39+
- uses: actions/setup-python@v5
40+
with:
41+
python-version: "3.12"
42+
43+
- name: Build
44+
run: uv build
45+
46+
- uses: pypa/gh-action-pypi-publish@release/v1
47+
48+
github-release:
49+
name: Create GitHub Release
50+
needs: [publish]
51+
if: github.event_name == 'push' && needs.publish.result == 'success'
52+
runs-on: ubuntu-24.04
53+
steps:
54+
- uses: actions/checkout@v4
55+
with:
56+
ref: ${{ github.ref_name }}
57+
58+
- name: Create GitHub Release
59+
run: |
60+
if gh release view "$TAG" &>/dev/null; then
61+
echo "Release $TAG already exists, skipping."
62+
exit 0
63+
fi
64+
if [[ "$TAG" == *-* ]]; then
65+
gh release create "$TAG" --generate-notes --prerelease
66+
else
67+
gh release create "$TAG" --generate-notes
68+
fi
69+
env:
70+
GH_TOKEN: ${{ github.token }}
71+
TAG: ${{ github.ref_name }}

.github/workflows/publish.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

.github/workflows/release-please.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.
Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,6 @@ name: Release
33
on:
44
push:
55
branches: [main]
6-
workflow_dispatch:
7-
inputs:
8-
branch:
9-
description: Branch to create the release from
10-
required: true
11-
default: main
12-
prerelease:
13-
description: Create a pre-release
14-
type: boolean
15-
default: false
166

177
permissions:
188
contents: write
@@ -35,17 +25,17 @@ jobs:
3525
- uses: googleapis/release-please-action@v4
3626
id: release
3727
with:
28+
token: ${{ steps.app-token.outputs.token }}
3829
config-file: .release-please-config.json
3930
manifest-file: .release-please-manifest.json
40-
token: ${{ steps.app-token.outputs.token }}
41-
target-branch: ${{ inputs.branch || github.ref_name }}
42-
prerelease: ${{ inputs.prerelease }}
4331

4432
publish:
45-
needs: [release-please]
33+
needs: release-please
4634
if: needs.release-please.outputs.release_created
4735
permissions:
4836
id-token: write
49-
uses: ./.github/workflows/publish.yml
37+
contents: write
38+
attestations: write
39+
uses: ./.github/workflows/publish.yaml
5040
with:
5141
tag: ${{ needs.release-please.outputs.tag_name }}

.readthedocs.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: 2
2+
3+
mkdocs:
4+
configuration: mkdocs.yml
5+
6+
build:
7+
os: ubuntu-24.04
8+
tools:
9+
python: "3.13"
10+
jobs:
11+
pre_create_environment:
12+
- asdf plugin add uv
13+
- asdf install uv latest
14+
- asdf global uv latest
15+
create_environment:
16+
- uv venv "${READTHEDOCS_VIRTUALENV_PATH}"
17+
install:
18+
- UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --frozen --group docs

pyproject.toml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,7 @@ Homepage = "https://github.com/FBumann/xarray_plotly"
3030
Documentation = "https://fbumann.github.io/xarray_plotly"
3131
Repository = "https://github.com/FBumann/xarray_plotly"
3232

33-
[project.optional-dependencies]
34-
dev = [
35-
"pytest==9.0.2",
36-
"pytest-cov==7.0.0",
37-
"mypy==1.19.1",
38-
"ruff==0.15.7",
39-
"pre-commit==4.5.1",
40-
"nbstripout==0.9.1",
41-
]
33+
[dependency-groups]
4234
docs = [
4335
"mkdocs==1.6.1",
4436
"mkdocs-material==9.7.6",
@@ -47,6 +39,15 @@ docs = [
4739
"mkdocs-plotly-plugin==0.1.3",
4840
"jupyter==1.1.1",
4941
]
42+
dev = [
43+
{include-group = "docs"},
44+
"pytest==9.0.2",
45+
"pytest-cov==7.0.0",
46+
"mypy==1.19.1",
47+
"ruff==0.15.7",
48+
"pre-commit==4.5.1",
49+
"nbstripout==0.9.1",
50+
]
5051

5152
[project.entry-points."xarray.backends"]
5253
# Entry point for xarray to auto-register the accessor (xarray >= 2024.01)

0 commit comments

Comments
 (0)