diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e7c04fa..b7686bb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -87,20 +87,34 @@ jobs: permissions: contents: write steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 with: pattern: geometry_script-blender-* path: dist merge-multiple: true + # The release doubles as a static extension repository, so a link to one of + # its ZIPs with `?repository=./index.json` can be dropped into Blender. + # Blender's repository generator is a standalone script, so no Blender download is needed. + - name: Generate extension repository + run: | + curl -fsSL -o "$RUNNER_TEMP/blender_ext.py" \ + https://raw.githubusercontent.com/blender/blender/v5.2.0/scripts/addons_core/bl_pkg/cli/blender_ext.py + python3 "$RUNNER_TEMP/blender_ext.py" server-generate --repo-dir dist + python3 tools/release_notes.py dist/index.json \ + --base-url "https://github.com/${{ github.repository }}/releases/download/nightly/" \ + --commit "${GITHUB_SHA::7}" > "$RUNNER_TEMP/notes.md" + - name: Publish nightly prerelease env: GH_TOKEN: ${{ github.token }} GH_REPO: ${{ github.repository }} run: | gh release delete nightly --yes --cleanup-tag || true - gh release create nightly dist/*.zip \ + gh release create nightly dist/*.zip dist/index.json \ --prerelease \ --target "$GITHUB_SHA" \ --title "Nightly" \ - --notes "Built from ${GITHUB_SHA::7}. Install the zip matching your Blender version from Preferences > Get Extensions > Install from Disk." + --notes-file "$RUNNER_TEMP/notes.md" diff --git a/README.md b/README.md index af1b908..c367708 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,18 @@ def repeat_grid(geometry: Geometry, width: int = 3, height: int = 3): ## Installation Geometry Script is a Blender extension and requires Blender 5.2 or newer. +Drag the box for your Blender version into Blender to install it: + +

+Geometry Script for Blender 5.2 +Geometry Script for Blender 5.3 +Geometry Script for Blender 5.4 +

+ +Blender asks to allow online access if it's off, then to add the Geometry Script repository, then confirms the install. The [`nightly` release](https://github.com/carson-katri/geometry-script/releases/tag/nightly) always lists the links for every Blender version with a build. + +To install manually instead: + 1. Download the ZIP matching your Blender version from the [`nightly` release](https://github.com/carson-katri/geometry-script/releases/tag/nightly), e.g. `geometry_script-1.0.0-blender-5.2.zip` 2. Open *Blender* > *Preferences* > *Get Extensions* 3. Open the dropdown at the top right, choose *Install from Disk...* and select the downloaded ZIP file diff --git a/book/src/images/install/blender-5.2-dark.svg b/book/src/images/install/blender-5.2-dark.svg new file mode 100644 index 0000000..89ea9aa --- /dev/null +++ b/book/src/images/install/blender-5.2-dark.svg @@ -0,0 +1,7 @@ + + + + Blender 5.2 + Drag into Blender + + diff --git a/book/src/images/install/blender-5.2-light.svg b/book/src/images/install/blender-5.2-light.svg new file mode 100644 index 0000000..a059af3 --- /dev/null +++ b/book/src/images/install/blender-5.2-light.svg @@ -0,0 +1,7 @@ + + + + Blender 5.2 + Drag into Blender + + diff --git a/book/src/images/install/blender-5.3-dark.svg b/book/src/images/install/blender-5.3-dark.svg new file mode 100644 index 0000000..7dd833f --- /dev/null +++ b/book/src/images/install/blender-5.3-dark.svg @@ -0,0 +1,7 @@ + + + + Blender 5.3 + Drag into Blender + + diff --git a/book/src/images/install/blender-5.3-light.svg b/book/src/images/install/blender-5.3-light.svg new file mode 100644 index 0000000..6d23a22 --- /dev/null +++ b/book/src/images/install/blender-5.3-light.svg @@ -0,0 +1,7 @@ + + + + Blender 5.3 + Drag into Blender + + diff --git a/book/src/images/install/blender-5.4-dark.svg b/book/src/images/install/blender-5.4-dark.svg new file mode 100644 index 0000000..d9b1bf4 --- /dev/null +++ b/book/src/images/install/blender-5.4-dark.svg @@ -0,0 +1,7 @@ + + + + Blender 5.4 + Drag into Blender + + diff --git a/book/src/images/install/blender-5.4-light.svg b/book/src/images/install/blender-5.4-light.svg new file mode 100644 index 0000000..2096bcd --- /dev/null +++ b/book/src/images/install/blender-5.4-light.svg @@ -0,0 +1,7 @@ + + + + Blender 5.4 + Drag into Blender + + diff --git a/book/src/setup/installation.md b/book/src/setup/installation.md index b62c0e9..47e9436 100644 --- a/book/src/setup/installation.md +++ b/book/src/setup/installation.md @@ -4,6 +4,26 @@ Geometry Script is a Blender extension and requires **Blender 5.2** or newer. Each build of the extension is generated for one Blender version, so its node functions match the nodes in that version exactly. Download the build that matches the version of Blender you use. +## Drag and drop +Drag the box for your Blender version into Blender: + +
+ +Blender 5.2 +Drag into Blender + + +Blender 5.3 +Drag into Blender + + +Blender 5.4 +Drag into Blender + +
+ +Blender asks to allow online access if it's off, then offers to add the Geometry Script repository and install the extension. The [`nightly` release](https://github.com/carson-katri/geometry-script/releases/tag/nightly) lists the links for every Blender version with a build. + ## From GitHub 1. Download the ZIP matching your Blender version from the [`nightly` release](https://github.com/carson-katri/geometry-script/releases/tag/nightly), e.g. `geometry_script-1.0.0-blender-5.2.zip` 2. Open *Blender* > *Preferences* > *Get Extensions* diff --git a/book/style.css b/book/style.css index 73e1fda..2043a8c 100644 --- a/book/style.css +++ b/book/style.css @@ -1,3 +1,41 @@ .coal { --bg: #1C1C1C !important; -} \ No newline at end of file +} +.extension-drops { + display: flex; + flex-wrap: wrap; + gap: 12px; + margin: 16px 0; +} + +.extension-drops a.extension-drop { + display: flex; + flex-direction: column; + gap: 4px; + flex: 1 1 140px; + padding: 16px; + border: 2px dashed var(--links); + border-radius: 8px; + text-decoration: none; + text-align: center; + cursor: grab; +} + +.extension-drops a.extension-drop:hover { + background: var(--theme-hover); + text-decoration: none; +} + +.extension-drops a.extension-drop:active { + cursor: grabbing; +} + +.extension-drop-title { + color: var(--fg); + font-weight: bold; +} + +.extension-drop-hint { + color: var(--icons); + font-size: 0.85em; +} diff --git a/tools/release_notes.py b/tools/release_notes.py new file mode 100644 index 0000000..0bd4e5c --- /dev/null +++ b/tools/release_notes.py @@ -0,0 +1,57 @@ +"""Print the release notes for a build with a drag and drop link per Blender series. + + python tools/release_notes.py dist/index.json --base-url https://github.com//releases/download// + +``index.json`` is the extension repository listing written by Blender's +``extension server-generate`` next to the ZIP files. Dropping one of the links +into Blender offers to add that repository and install the matching build. +""" + +from __future__ import annotations + +import argparse +import json +import sys +import urllib.parse +from pathlib import Path + + +def drop_url(base_url: str, package: dict[str, str]) -> str: + query = {"repository": "./index.json", "blender_version_min": package["blender_version_min"]} + if "blender_version_max" in package: + query["blender_version_max"] = package["blender_version_max"] + archive = package["archive_url"].removeprefix("./") + return f"{base_url.rstrip('/')}/{archive}?{urllib.parse.urlencode(query, safe='/')}" + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) + parser.add_argument("index", type=Path, help="Repository listing (index.json)") + parser.add_argument("--base-url", required=True, help="URL the ZIP files and index.json are served from") + parser.add_argument("--commit", default="", help="Commit the packages were built from") + args = parser.parse_args() + + packages = json.loads(args.index.read_text(encoding="utf-8"))["data"] + packages.sort(key=lambda package: tuple(int(part) for part in package["blender_version_min"].split("."))) + + lines = [] + if args.commit: + lines += [f"Built from {args.commit}.", ""] + lines += [ + "Drag the link for your Blender version into Blender to install it:", + "", + ] + for package in packages: + series = ".".join(package["blender_version_min"].split(".")[:2]) + lines.append(f"- [Geometry Script for Blender {series}]({drop_url(args.base_url, package)})") + lines += [ + "", + "Or download the ZIP matching your Blender version and install it from " + "Preferences > Get Extensions > Install from Disk.", + ] + print("\n".join(lines)) + return 0 + + +if __name__ == "__main__": + sys.exit(main())