diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml index 6c5d99d..00a7984 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/release-cli.yml @@ -25,6 +25,11 @@ jobs: needs: release-please if: needs.release-please.outputs.release_created == 'true' runs-on: ubuntu-latest + # npm trusted publishing: the registry exchanges this job's OIDC token for + # a short-lived publish credential, so no long-lived NPM_TOKEN is needed. + permissions: + contents: read + id-token: write steps: - uses: actions/checkout@v4 @@ -35,6 +40,10 @@ jobs: node-version: 22 registry-url: https://registry.npmjs.org + # Trusted publishing needs npm 11.5.1 or newer; Node 22 bundles npm 10. + - name: Upgrade npm + run: npm install -g npm@11 + - name: Install dependencies run: pnpm install --frozen-lockfile @@ -51,7 +60,10 @@ jobs: - name: Test built CLI run: pnpm exec vitest run packages/cli/src/built-cli.test.ts + # pnpm pack rewrites workspace: ranges; npm publish then authenticates + # through OIDC and attaches provenance automatically. - name: Publish to NPM - run: pnpm --filter skillx-sh publish --no-git-checks --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + working-directory: packages/cli + run: | + pnpm pack --pack-destination "$RUNNER_TEMP" + npm publish "$RUNNER_TEMP"/skillx-sh-*.tgz --access public diff --git a/packages/cli/package.json b/packages/cli/package.json index d99b629..b9bd8f0 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -3,6 +3,11 @@ "version": "0.4.1", "description": "The Only Skill That Your AI Agent Needs.", "type": "module", + "repository": { + "type": "git", + "url": "git+https://github.com/nextlevelbuilder/skillx.git", + "directory": "packages/cli" + }, "bin": { "skillx": "./bin/skillx.js" },