From bd239797a078b6a907da821b8b9396136c81827d Mon Sep 17 00:00:00 2001 From: Tobias Barth Date: Thu, 19 Nov 2026 12:21:22 +0100 Subject: [PATCH] chore(sdk,cli): publish the packages to GitHub Packages Both packages are to become internal to Aignostics. The release workflow now publishes them to the aignostics organisation's npm registry on GitHub Packages with the workflow's GITHUB_TOKEN, and the repository's .npmrc maps the @aignostics scope there. The READMEs explain how to authenticate for installs. Refs: TSSDK-85 Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release-please.yml | 16 ++++++++++------ .npmrc | 5 ++++- README.md | 9 +++++++++ docs/SOFTWARE_ARCHITECTURE.md | 12 ++++++------ packages/cli/README.md | 2 ++ packages/cli/package.json | 9 +++++++-- packages/sdk/README.md | 2 ++ packages/sdk/package.json | 9 +++++++-- 8 files changed, 47 insertions(+), 17 deletions(-) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 6bd303a..d03ebd5 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -46,6 +46,7 @@ jobs: name: publish-sdk permissions: contents: read + packages: write # npm publish uploads the package to GitHub Packages runs-on: ubuntu-latest needs: [release-please, gate] if: needs.release-please.outputs.sdk-release-created == 'true' @@ -65,7 +66,8 @@ jobs: with: node-version-file: '.node-version' cache: 'npm' - registry-url: 'https://registry.npmjs.org' + registry-url: 'https://npm.pkg.github.com' + scope: '@aignostics' - name: Install dependencies run: npm ci @@ -73,16 +75,17 @@ jobs: - name: Build SDK run: npm run build:sdk - - name: Publish SDK to npm + - name: Publish SDK to GitHub Packages working-directory: packages/sdk run: npm publish env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} publish-cli: name: publish-cli permissions: contents: read + packages: write # npm publish uploads the package to GitHub Packages runs-on: ubuntu-latest needs: [release-please, gate] if: needs.release-please.outputs.cli-release-created == 'true' @@ -102,7 +105,8 @@ jobs: with: node-version-file: '.node-version' cache: 'npm' - registry-url: 'https://registry.npmjs.org' + registry-url: 'https://npm.pkg.github.com' + scope: '@aignostics' - name: Install dependencies run: npm ci @@ -110,8 +114,8 @@ jobs: - name: Build CLI run: npm run build:cli - - name: Publish CLI to npm + - name: Publish CLI to GitHub Packages working-directory: packages/cli run: npm publish env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.npmrc b/.npmrc index 0f247cb..52b7866 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,4 @@ -@aignostics:registry=https://registry.npmjs.org/ +# @aignostics packages are published to GitHub Packages. Installing them needs +# a GitHub token with read:packages in your user-level ~/.npmrc: +# //npm.pkg.github.com/:_authToken= +@aignostics:registry=https://npm.pkg.github.com/ diff --git a/README.md b/README.md index 29c6b61..c062e4f 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,15 @@ For general information about the Aignostics Platform [check this documentation ## Installation +Both packages are published to GitHub Packages, and only members of the aignostics GitHub organisation can install them. Add the registry and a GitHub token with the `read:packages` scope to your user-level `~/.npmrc`: + +```ini +@aignostics:registry=https://npm.pkg.github.com/ +//npm.pkg.github.com/:_authToken= +``` + +With the GitHub CLI, `gh auth refresh -s read:packages` adds the scope to your login and `gh auth token` prints the token. + ### SDK Package ```bash diff --git a/docs/SOFTWARE_ARCHITECTURE.md b/docs/SOFTWARE_ARCHITECTURE.md index 424c17f..010b0d6 100644 --- a/docs/SOFTWARE_ARCHITECTURE.md +++ b/docs/SOFTWARE_ARCHITECTURE.md @@ -56,7 +56,7 @@ The Aignostics TypeScript SDK Repository provides TypeScript developers with too | **CLI Users** | Interactive tool for platform operations without coding | | **Platform Engineers** | Maintainable codebase aligned with API evolution | | **Security Teams** | Secure token management and authentication flows | -| **DevOps** | Reliable testing, clear build pipeline, npm publishing | +| **DevOps** | Reliable testing, clear build pipeline, package publishing | --- @@ -70,7 +70,7 @@ The Aignostics TypeScript SDK Repository provides TypeScript developers with too | **TypeScript Strict Mode** | Enforces type safety across codebase | | **OpenAPI Specification** | External dependency from Platform API (staging endpoint) | | **Docker** | Required for OpenAPI code generation (v7.14.0) | -| **npm Registry** | Packages published to public npm registry | +| **GitHub Packages** | Packages published to the aignostics organisation's npm registry on GitHub Packages, readable only by organisation members | | **Turborepo** | Workspace orchestration and build caching | ### 2.2 Organizational Constraints @@ -102,7 +102,7 @@ graph LR subgraph "External Systems" API[Aignostics Platform API] AUTH[Auth0 OIDC Provider] - NPM[npm Registry] + NPM[GitHub Packages npm registry] KEYCHAIN[OS Keychain/Credential Manager] end @@ -133,7 +133,7 @@ graph LR | **Aignostics Platform API** | REST (JSON/HTTP) | AI model execution, data retrieval | | **Auth0** | OAuth2/OIDC | User authentication, token issuance | | **OS Keychain** | Native API | Secure token storage | -| **npm Registry** | HTTP | Package distribution | +| **GitHub Packages** | HTTP (npm registry) | Package distribution | ### 3.2 Technical Context @@ -549,7 +549,7 @@ graph TB CLI_DIST[cli/dist/] end - subgraph "npm Registry" + subgraph "GitHub Packages" SDK_PKG[SDK Package] CLI_PKG[CLI Package] end @@ -818,7 +818,7 @@ graph LR - Release PR opened per package (`sdk`, `cli`), kept up to date as commits land - Version bumped, `CHANGELOG.md` generated, and `package.json` updated on PR merge - Git tags and GitHub Releases created (independent package versions) -- npm publish (independent package versions) +- npm publish to GitHub Packages (independent package versions) --- diff --git a/packages/cli/README.md b/packages/cli/README.md index fed70de..a172069 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -4,6 +4,8 @@ Command-line interface for the Aignostics Platform. ## Installation +The package is published to GitHub Packages. Set up the registry and a token first, as described in the [repository README](https://github.com/aignostics/typescript-sdk#installation). + ```bash npm install -g @aignostics/cli ``` diff --git a/packages/cli/package.json b/packages/cli/package.json index 62eaf52..8025905 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -14,8 +14,13 @@ "LICENSE" ], "publishConfig": { - "registry": "https://registry.npmjs.org", - "access": "public" + "registry": "https://npm.pkg.github.com", + "access": "restricted" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/aignostics/typescript-sdk.git", + "directory": "packages/cli" }, "scripts": { "build": "tsdown", diff --git a/packages/sdk/README.md b/packages/sdk/README.md index ca9d8f8..8aa82c7 100644 --- a/packages/sdk/README.md +++ b/packages/sdk/README.md @@ -4,6 +4,8 @@ The TypeScript SDK for the Aignostics Platform. ## Installation +The package is published to GitHub Packages. Set up the registry and a token first, as described in the [repository README](https://github.com/aignostics/typescript-sdk#installation). + ```bash npm install @aignostics/sdk ``` diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 4cf903b..3ffa7c8 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -27,8 +27,13 @@ "LICENSE" ], "publishConfig": { - "registry": "https://registry.npmjs.org", - "access": "public" + "registry": "https://npm.pkg.github.com", + "access": "restricted" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/aignostics/typescript-sdk.git", + "directory": "packages/sdk" }, "scripts": { "build": "tsdown",