From c28c36c3bd0d9537c0b6f4ec0bdda7e16cd152e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Tue, 19 Nov 2024 17:29:22 +0100 Subject: [PATCH] Fix publishing of node package --- README.md | 22 ++++++++++++++++++---- tag_publish/cli.py | 14 ++++++++++---- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index bdcfb92..516d60c 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ The configuration file is `.github/publish.yaml`, the schema is `https://raw.git Dry run publish: `GITHUB_REF=... tag-publish --dry-run ...` -### To pypi +### Python package to pypi repository Minimum configuration: @@ -172,7 +172,7 @@ build: ## Build the Docker images docker build --build-arg=VERSION=$(VERSION) --tag=$(GITHUB_REPOSITORY) . ``` -### To Docker registry +### Docker image to registry The minimal config is like this: @@ -222,14 +222,28 @@ If the `ci/dpkg-versions.yaml` or `.github/dpkg-versions.yaml` file is present, The versions will be updated by [GHCI](https://github.com/camptocamp/github-app-geo-project/) application. +### Node package to npm repository + +Minimum configuration: + +```yaml +node: + packages: + - {} +``` + +If the repository server is `npm.pkg.github.com` we will do a login using `GITHUB_TOKEN`. + +By default the package will be published only on tag. + ### HELM The minimal config is like this: ```yaml helm: - folders: - - . + packages: + - {} ``` This will publish the `helm` charts in the current folder using [chart releaser](https://github.com/helm/chart-releaser). diff --git a/tag_publish/cli.py b/tag_publish/cli.py index d6ddafa..51772a2 100644 --- a/tag_publish/cli.py +++ b/tag_publish/cli.py @@ -249,12 +249,18 @@ def _handle_node_publish( node_config = config.get("node", {}) if node_config: for package in node_config.get("packages", []): - if package.get("group", tag_publish.configuration.PIP_PACKAGE_GROUP_DEFAULT) == group: + if package.get("group", tag_publish.configuration.NODE_PACKAGE_GROUP_DEFAULT) == group: publish = version_type in node_config.get( - "versions", tag_publish.configuration.PYPI_VERSIONS_DEFAULT + "versions", tag_publish.configuration.NODE_VERSIONS_DEFAULT ) - folder = package.get("folder", tag_publish.configuration.PYPI_PACKAGE_FOLDER_DEFAULT) - for repo_name, repo_config in node_config.get("repository", {}).items(): + folder = package.get("folder", tag_publish.configuration.NODE_PACKAGE_FOLDER_DEFAULT) + for repo_name, repo_config in node_config.get( + "repository", + cast( + tag_publish.configuration.NodeRepository, + tag_publish.configuration.NODE_REPOSITORY_DEFAULT, + ), + ).items(): if dry_run: print( f"{'Publishing' if publish else 'Checking'} '{folder}' to {repo_name}, "