From 8988bdad2bd860270cb517eb3f1eea854acb812a Mon Sep 17 00:00:00 2001 From: FBumann <117816358+FBumann@users.noreply.github.com> Date: Mon, 23 Mar 2026 13:55:24 +0100 Subject: [PATCH 1/6] 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) --- .github/workflows/docs.yml | 2 +- .github/workflows/publish.yaml | 62 +++++++++++++++++++ .github/workflows/publish.yml | 43 ------------- .github/workflows/release-please.yml | 42 ------------- .../workflows/{release.yml => release.yaml} | 20 ++---- 5 files changed, 68 insertions(+), 101 deletions(-) create mode 100644 .github/workflows/publish.yaml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/release-please.yml rename .github/workflows/{release.yml => release.yaml} (67%) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 43ce4e9..a53f854 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -7,7 +7,7 @@ on: branches: [main] workflow_dispatch: # Manual trigger workflow_run: - workflows: ["Release (Manual)", "Release Please"] + workflows: ["Publish"] types: [completed] permissions: diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..e9e4eed --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,62 @@ +name: Publish + +on: + push: + tags: ["v*"] + workflow_call: + inputs: + tag: + required: true + type: string + +permissions: + contents: write + id-token: write + attestations: write + +jobs: + publish: + name: Build & publish to PyPI + runs-on: ubuntu-24.04 + timeout-minutes: 10 + environment: + name: pypi + url: https://pypi.org/project/xarray_plotly + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ inputs.tag || github.ref_name }} + fetch-depth: 0 + + - uses: astral-sh/setup-uv@v7 + with: + enable-cache: true + + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Build + run: uv build + + - uses: pypa/gh-action-pypi-publish@release/v1 + + github-release: + name: Create GitHub Release + if: github.event_name == 'push' + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.ref_name }} + + - name: Create GitHub Release + run: | + if [[ "$TAG" == *-* ]]; then + gh release create "$TAG" --generate-notes --prerelease + else + gh release create "$TAG" --generate-notes + fi + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ github.ref_name }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index b3c6943..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Publish - -on: - workflow_dispatch: - inputs: - tag: - description: 'Release tag to publish (e.g. v0.0.15)' - required: true - type: string - workflow_call: - inputs: - tag: - required: true - type: string - -jobs: - publish: - name: Build & publish to PyPI - runs-on: ubuntu-24.04 - timeout-minutes: 10 - environment: - name: pypi - url: https://pypi.org/project/xarray_plotly - permissions: - id-token: write - steps: - - uses: actions/checkout@v6 - with: - ref: ${{ inputs.tag }} - fetch-depth: 0 - - - uses: astral-sh/setup-uv@v7 - with: - enable-cache: true - - - uses: actions/setup-python@v6 - with: - python-version: "3.12" - - - name: Build - run: uv build - - - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml deleted file mode 100644 index b50c60d..0000000 --- a/.github/workflows/release-please.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Release Please - -on: - push: - branches: - - main - -permissions: - contents: write - pull-requests: write - id-token: write # for PyPI trusted publishing - -jobs: - release-please: - runs-on: ubuntu-latest - outputs: - release_created: ${{ steps.release.outputs.release_created }} - tag_name: ${{ steps.release.outputs.tag_name }} - steps: - - uses: googleapis/release-please-action@v4 - id: release - with: - config-file: .release-please-config.json - manifest-file: .release-please-manifest.json - - publish: - needs: release-please - if: ${{ needs.release-please.outputs.release_created }} - runs-on: ubuntu-latest - permissions: - id-token: write - steps: - - uses: actions/checkout@v6 - - - name: Install uv - uses: astral-sh/setup-uv@v7 - - - name: Build package - run: uv build - - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yaml similarity index 67% rename from .github/workflows/release.yml rename to .github/workflows/release.yaml index c1b7665..14a1f18 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yaml @@ -3,16 +3,6 @@ name: Release on: push: branches: [main] - workflow_dispatch: - inputs: - branch: - description: Branch to create the release from - required: true - default: main - prerelease: - description: Create a pre-release - type: boolean - default: false permissions: contents: write @@ -35,17 +25,17 @@ jobs: - uses: googleapis/release-please-action@v4 id: release with: + token: ${{ steps.app-token.outputs.token }} config-file: .release-please-config.json manifest-file: .release-please-manifest.json - token: ${{ steps.app-token.outputs.token }} - target-branch: ${{ inputs.branch || github.ref_name }} - prerelease: ${{ inputs.prerelease }} publish: - needs: [release-please] + needs: release-please if: needs.release-please.outputs.release_created permissions: id-token: write - uses: ./.github/workflows/publish.yml + contents: write + attestations: write + uses: ./.github/workflows/publish.yaml with: tag: ${{ needs.release-please.outputs.tag_name }} From 9c804c8c14bbf5a0026dfdaf549272b1297f4f8e Mon Sep 17 00:00:00 2001 From: FBumann <117816358+FBumann@users.noreply.github.com> Date: Mon, 23 Mar 2026 14:11:02 +0100 Subject: [PATCH 2/6] fix(ci): gate github-release on publish and add idempotency check Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/publish.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index e9e4eed..964fb9a 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -43,7 +43,8 @@ jobs: github-release: name: Create GitHub Release - if: github.event_name == 'push' + needs: [publish] + if: github.event_name == 'push' && needs.publish.result == 'success' runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 @@ -52,6 +53,10 @@ jobs: - name: Create GitHub Release run: | + if gh release view "$TAG" &>/dev/null; then + echo "Release $TAG already exists, skipping." + exit 0 + fi if [[ "$TAG" == *-* ]]; then gh release create "$TAG" --generate-notes --prerelease else From 6b38ea537410260ec7a71272f9a1d4a9c0afeb35 Mon Sep 17 00:00:00 2001 From: FBumann <117816358+FBumann@users.noreply.github.com> Date: Mon, 23 Mar 2026 14:19:02 +0100 Subject: [PATCH 3/6] ci: add Read the Docs config with uv Co-Authored-By: Claude Opus 4.6 (1M context) --- .readthedocs.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .readthedocs.yaml diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..bb21ba9 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,18 @@ +version: 2 + +mkdocs: + configuration: mkdocs.yml + +build: + os: ubuntu-24.04 + tools: + python: "3.13" + jobs: + pre_create_environment: + - asdf plugin add uv + - asdf install uv latest + - asdf global uv latest + create_environment: + - uv venv "${READTHEDOCS_VIRTUALENV_PATH}" + install: + - UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --frozen --extra docs From 37cd9e7849d58873fe29a935e9b7e5e877a3e091 Mon Sep 17 00:00:00 2001 From: FBumann <117816358+FBumann@users.noreply.github.com> Date: Mon, 23 Mar 2026 14:29:54 +0100 Subject: [PATCH 4/6] build: move optional-dependencies to dependency-groups Co-Authored-By: Claude Opus 4.6 (1M context) --- .readthedocs.yaml | 2 +- pyproject.toml | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index bb21ba9..a287eb6 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -15,4 +15,4 @@ build: create_environment: - uv venv "${READTHEDOCS_VIRTUALENV_PATH}" install: - - UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --frozen --extra docs + - UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --frozen --group docs diff --git a/pyproject.toml b/pyproject.toml index 6ff34f0..692c1a2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,15 +30,7 @@ Homepage = "https://github.com/FBumann/xarray_plotly" Documentation = "https://fbumann.github.io/xarray_plotly" Repository = "https://github.com/FBumann/xarray_plotly" -[project.optional-dependencies] -dev = [ - "pytest==9.0.2", - "pytest-cov==7.0.0", - "mypy==1.19.1", - "ruff==0.15.7", - "pre-commit==4.5.1", - "nbstripout==0.9.1", -] +[dependency-groups] docs = [ "mkdocs==1.6.1", "mkdocs-material==9.7.6", @@ -47,6 +39,15 @@ docs = [ "mkdocs-plotly-plugin==0.1.3", "jupyter==1.1.1", ] +dev = [ + {include-group = "docs"}, + "pytest==9.0.2", + "pytest-cov==7.0.0", + "mypy==1.19.1", + "ruff==0.15.7", + "pre-commit==4.5.1", + "nbstripout==0.9.1", +] [project.entry-points."xarray.backends"] # Entry point for xarray to auto-register the accessor (xarray >= 2024.01) From bcfb921a9ebb2113592e9956e93edd7a82208b82 Mon Sep 17 00:00:00 2001 From: FBumann <117816358+FBumann@users.noreply.github.com> Date: Mon, 23 Mar 2026 16:10:07 +0100 Subject: [PATCH 5/6] ci: use --group instead of --extra for dependency-groups Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/ci.yml | 4 ++-- .github/workflows/docs.yml | 2 +- .github/workflows/latest-deps.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 194f981..6d3cd21 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: run: uv python install ${{ matrix.python-version }} - name: Install dependencies - run: uv sync --extra dev + run: uv sync --group dev - name: Lint run: uv run ruff check . @@ -53,7 +53,7 @@ jobs: uses: astral-sh/setup-uv@v7 - name: Install dependencies - run: uv sync --extra docs + run: uv sync --group docs - name: Build docs run: uv run mkdocs build diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index a53f854..4a4cce8 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -32,7 +32,7 @@ jobs: uses: astral-sh/setup-uv@v7 - name: Install dependencies - run: uv sync --extra docs + run: uv sync --group docs - name: Build docs run: uv run mkdocs build diff --git a/.github/workflows/latest-deps.yml b/.github/workflows/latest-deps.yml index a8cd16f..80dfe7f 100644 --- a/.github/workflows/latest-deps.yml +++ b/.github/workflows/latest-deps.yml @@ -25,7 +25,7 @@ jobs: run: uv python install ${{ matrix.python-version }} - name: Install with latest dependencies - run: uv sync --extra dev --upgrade + run: uv sync --group dev --upgrade - name: Test run: uv run pytest --cov=xarray_plotly From 4b0d151c1babf4afd51f641cd26a504b9ca1c46a Mon Sep 17 00:00:00 2001 From: FBumann <117816358+FBumann@users.noreply.github.com> Date: Mon, 23 Mar 2026 16:17:37 +0100 Subject: [PATCH 6/6] ci: add publish concurrency group, clean up pr-title trigger Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/pr-title.yml | 2 +- .github/workflows/publish.yaml | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-title.yml b/.github/workflows/pr-title.yml index 21f5b40..a745662 100644 --- a/.github/workflows/pr-title.yml +++ b/.github/workflows/pr-title.yml @@ -2,7 +2,7 @@ name: PR Title Check on: pull_request: - types: [opened, edited, synchronize, reopened] + types: [opened, edited, reopened] jobs: validate: diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 964fb9a..9c56a3a 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -9,6 +9,10 @@ on: required: true type: string +concurrency: + group: publish-${{ inputs.tag || github.ref_name }} + cancel-in-progress: false + permissions: contents: write id-token: write