npm: Simplify release pipeline.

Releasing API updates is quite a long and error prone process, so the point that it was limiting our ability to push frequent updates in practice. There were 5 tag, commit, wait, and proceed steps and you'd have to start over or force push if a mistake was made.

This keeps all the npm packages as they were, but versions everything from a single source of truth, which is this project's main version. Everything builds on a tag on the main repo, much like we did for a regular IDE docs RTD release.

It also skips the PyPI for jedi as an intermediate step, which isn't really needed and required us to have this strict order of publication steps.
This commit is contained in:
Laurens Valk
2026-05-29 20:38:37 +02:00
parent a9be86238d
commit 95b168355e
12 changed files with 97 additions and 255 deletions
-15
View File
@@ -13,18 +13,3 @@ jobs:
working-directory: ./jedi
- run: poetry run pytest -vv
working-directory: ./jedi
publish:
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'pybricks_jedi/')
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- run: pipx install poetry
- run: poetry install
working-directory: ./jedi
- run: poetry build
working-directory: ./jedi
- run: poetry publish
working-directory: ./jedi
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_PYBRICKS_JEDI_TOKEN }}
+7 -3
View File
@@ -2,13 +2,15 @@ name: Release @pybricks/ide-docs
on:
push:
tags:
- '@pybricks/ide-docs/**'
tags:
- 'v3.*'
jobs:
publish_ide_docs:
runs-on: ubuntu-22.04
steps:
- name: Get version from tag
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
- name: Ubuntu packages
run: |
sudo apt-get update
@@ -28,8 +30,10 @@ jobs:
poetry install --only=doc
- uses: actions/setup-node@v3
with:
node-version: '14.x'
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- run: npm version --no-git-tag-version "$VERSION"
working-directory: npm/ide-docs
- run: yarn build
working-directory: npm/ide-docs
- run: yarn publish
+15 -5
View File
@@ -2,20 +2,30 @@ name: Release @pybricks/jedi
on:
push:
tags:
- '@pybricks/jedi/**'
tags:
- 'v3.*'
jobs:
publish_jedi:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
# Setup .npmrc file to publish to npm
- name: Get version from tag
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install poetry
run: pipx install poetry
- name: Set pybricks-jedi version
run: poetry version "$VERSION"
working-directory: jedi
- uses: actions/setup-node@v3
with:
node-version: '16.x'
node-version: '18.x'
registry-url: 'https://registry.npmjs.org'
- run: ./build.py
- run: ./build.py "$VERSION"
working-directory: npm/jedi
- run: yarn publish
working-directory: npm/jedi/build
+5
View File
@@ -163,6 +163,11 @@ Linting:
poetry run flake8 # check Python
poetry run doc8 # check Restructured Text
Building all release artifacts (docs, jedi, npm packages):
# Linux/macOS only
./build-all.sh
[vscode]: https://code.visualstudio.com/
[git]: https://git-scm.com/
[python]: https://www.python.org/
Executable
+45
View File
@@ -0,0 +1,45 @@
#!/usr/bin/env bash
# Build all release artifacts locally (equivalent to CI workflows, minus publish).
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Activate the project venv so python/make/etc. all use it without poetry run
source "$REPO_ROOT/.venv/bin/activate"
# Read version from pyproject.toml
VERSION=$(grep '^version = ' "$REPO_ROOT/pyproject.toml" | head -1 | sed 's/version = "\(.*\)"/\1/')
echo "==> Building version $VERSION"
# lint
echo "==> Linting"
cd "$REPO_ROOT"
flake8
doc8
# pybricks-jedi wheel (from local source)
echo "==> Testing pybricks-jedi"
cd "$REPO_ROOT/jedi"
poetry run pytest -vv
echo "==> Building pybricks-jedi wheel"
cd "$REPO_ROOT/jedi"
rm -rf dist/
poetry build --format=wheel
# @pybricks/jedi npm package
echo "==> Building @pybricks/jedi"
cd "$REPO_ROOT"
python3 npm/jedi/build.py "$VERSION"
# @pybricks/ide-docs npm package
echo "==> Building @pybricks/ide-docs"
cd "$REPO_ROOT"
make -C doc clean
cd "$REPO_ROOT/npm/ide-docs"
yarn build
echo ""
echo "Build complete."
echo " jedi npm package : npm/jedi/build/"
echo " ide-docs : npm/ide-docs/html/"
+2 -1
View File
@@ -1,6 +1,7 @@
[tool.poetry]
name = "pybricks_jedi"
version = "1.17.0"
# Version is set automatically at build time from the root pyproject.toml. Do not edit.
version = "0.0.0"
description = "Code completion for Pybricks."
authors = ["The Pybricks Authors <team@pybricks.com>"]
license = "MIT"
-2
View File
@@ -1,2 +0,0 @@
version-tag-prefix "@pybricks/ide-docs/v"
version-git-message "@pybricks/ide-docs v%s"
-114
View File
@@ -1,114 +0,0 @@
# Changelog
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
## 2.20.0 - 2024-02-26
### Changed
- Updated docs to v3.6.0b5.
## 2.19.0 - 2024-04-11
### Changed
- Updated docs to v3.5.0.
## 2.18.0 - 2024-04-05
### Changed
- Updated docs to v3.5.0b2.
## 2.17.0 - 2024-03-21
### Changed
- Updated docs to v3.5.0b1.
## 2.16.0 - 2024-03-11
### Changed
- Updated docs to v3.4.0.
## 2.15.0 - 2024-03-05
### Changed
- Updated docs to v3.4.0b5.
## 2.14.0 - 2024-01-30
### Changed
- Updated docs to v3.4.0b3.
## 2.13.0 - 2023-11-24
### Changed
- Updated docs to v3.4.0b1.
## 2.12.0 - 2023-11-24
### Changed
- Updated docs to v3.3.0.
## 2.11.0 - 2023-11-20
### Changed
- Updated docs to v3.3.0c1.
## 2.10.0 - 2023-10-26
### Changed
- Updated docs to v3.3.0b9.
## 2.9.0 - 2023-05-16
### Changed
- Updated docs to v3.3.0b5.
## 2.8.0 - 2023-04-21
### Changed
- Updated docs to v3.3.0b4.
## 2.7.0 - 2022-12-20
### Changed
- Updated docs to v3.2.0c2.
## 2.6.0 - 2022-12-09
### Changed
- Updated docs to v3.2.0c1.
## 2.5.0 - 2022-12-02
### Changed
- Updated docs to v3.2.0b6.
## 2.4.0 - 2022-11-11
### Changed
- Updated docs to v3.2.0b5.
## 2.3.0 - 2022-10-21
### Changed
- Updated docs to v3.2.0b4.
## 2.2.0 - 2022-06-02
### Changed
- Updated docs to v3.2.0b1.
## 2.1.0 - 2021-12-16
### Changed
- Updated docs to v3.1.0.
## 2.0.1 - 2021-11-19
### Fixed
- Fixed link to Color Light Matrix page.
## 2.0.0 - 2021-11-19
### Changed
- Changed package directory structure.
- Updated docs to v3.1.0rc1.
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@pybricks/ide-docs",
"version": "2.20.0",
"version": "0.0.0",
"description": "Special build of Pybricks API docs for embedding in an IDE.",
"repository": {
"type": "git",
-2
View File
@@ -1,2 +0,0 @@
version-tag-prefix "@pybricks/jedi/v"
version-git-message "@pybricks/jedi v%s"
-99
View File
@@ -1,99 +0,0 @@
# Changelog
<!-- refer to https://keepachangelog.com/en/1.0.0/ for guidance -->
## Unreleased
## 1.17.0 - 2025-02-26
### Changed
- Updated `pybricks_jedi` Python package to v1.17.0.
## 1.16.0 - 2024-04-05
### Changed
- Updated `pybricks_jedi` Python package to v1.16.0.
## 1.15.0 - 2024-03-21
### Changed
- Updated `pybricks_jedi` Python package to v1.15.0.
## 1.14.0 - 2024-03-05
### Changed
- Updated `pybricks_jedi` Python package to v1.14.0.
## 1.13.0 - 2024-01-30
### Changed
- Updated `pybricks_jedi` Python package to v1.13.0.
### Changed
- Updated `pybricks_jedi` Python package to v1.12.0.
## 1.12.0 - 2023-11-24
### Changed
- Updated `pybricks_jedi` Python package to v1.12.0.
## 1.11.0 - 2023-11-20
### Changed
- Updated `pybricks_jedi` Python package to v1.11.0.
## 1.10.0 - 2023-10-26
### Changed
- Updated `pybricks_jedi` Python package to v1.10.0.
## 1.9.0 - 2023-05-16
### Changed
- Updated `pybricks_jedi` Python package to v1.9.0.
## 1.8.0 - 2023-04-21
### Changed
- Updated `pybricks_jedi` Python package to v1.8.0.
## 1.7.0 - 2022-12-28
### Changed
- Updated `pybricks_jedi` Python package to v1.7.0.
## 1.6.0 - 2022-12-09
### Changed
- Updated `pybricks_jedi` Python package to v1.6.0.
## 1.5.0 - 2022-12-02
### Changed
- Updated `pybricks_jedi` Python package to v1.5.0.
## 1.4.0 - 2022-12-02
### Changed
- Updated `pybricks_jedi` Python package to v1.4.0.
## 1.3.0 - 2022-11-11
### Changed
- Updated `pybricks_jedi` Python package to v1.3.0.
## 1.2.0 - 2022-10-21
### Changed
- Updated `pybricks_jedi` Python package to v1.2.0.
## 1.0.1 - 2022-09-07
### Fixed
- Fixed exports.
- Fixed missing README and CHANGELOG.
## 1.0.0 - 2022-09-07
### Added
- Added new @pybricks/jedi package.
+22 -13
View File
@@ -8,11 +8,19 @@ import subprocess
import sys
import zipfile
BUILD_DIR = (pathlib.Path(__file__).parent / "build").resolve()
if len(sys.argv) != 2:
print(f"Usage: {sys.argv[0]} <version>", file=sys.stderr)
sys.exit(1)
VERSION = sys.argv[1]
ROOT_DIR = pathlib.Path(__file__).parent.resolve()
JEDI_SRC_DIR = (ROOT_DIR / ".." / ".." / "jedi").resolve()
BUILD_DIR = (ROOT_DIR / "build").resolve()
package_json = {
"name": "@pybricks/jedi",
"version": "1.17.0",
"version": VERSION,
"description": "Binary distribution of pybricks-jedi Python package and dependencies for use with Pyodide.",
"repository": {
"type": "git",
@@ -30,7 +38,14 @@ whl_map: dict[str, str] = {}
shutil.rmtree(BUILD_DIR, True)
BUILD_DIR.mkdir()
# download package and dependencies (*.whl files)
# build pybricks-jedi wheel from local source
subprocess.check_call(["poetry", "build", "--format=wheel"], cwd=JEDI_SRC_DIR)
# copy locally built wheel to build dir
for whl in (JEDI_SRC_DIR / "dist").glob("pybricks_jedi-*.whl"):
shutil.copy(whl, BUILD_DIR)
# download transitive dependencies from PyPI, using the local wheel to satisfy pybricks-jedi itself
subprocess.check_call(
[
sys.executable,
@@ -38,7 +53,8 @@ subprocess.check_call(
"pip",
"download",
"--only-binary=any",
"pybricks-jedi==1.17.0",
f"--find-links={BUILD_DIR}",
"pybricks-jedi",
],
cwd=BUILD_DIR,
)
@@ -79,13 +95,8 @@ for whl in BUILD_DIR.glob("*.whl"):
license_identifiers.add(license)
# TODO: The LICENSE workaround for the pybricks-jedi package can be
# dropped after the next release of that package
if whl.name.startswith("pybricks_jedi-"):
LICENSE = (
pathlib.Path(__file__).parent.parent.parent / "jedi" / "LICENSE"
).resolve()
with open(LICENSE) as lf:
with open(JEDI_SRC_DIR / "LICENSE") as lf:
license_text[whl.name] = lf.read()
else:
try:
@@ -126,7 +137,5 @@ with open(BUILD_DIR / "LICENSE", "w") as f:
# copy additional files
ROOT_DIR = (pathlib.Path(__file__).parent).resolve()
for file in "README.md", "CHANGELOG.md":
for file in ("README.md",):
shutil.copy(ROOT_DIR / file, BUILD_DIR / file)