diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a5c5def..3d6c5a9 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -62,13 +62,29 @@ jobs: - uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '22' registry-url: 'https://registry.npmjs.org' + # Upgrade npm to a version that supports OIDC trusted publishing (>= 11.5.1) + - name: Upgrade npm for OIDC trusted publishing + run: npm install -g npm@latest + - run: npm ci - run: npm run build - - run: npm publish --provenance --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Determine npm dist-tag from package.json + id: dist_tag + run: | + VERSION=$(node -p "require('./package.json').version") + if [[ "$VERSION" == *-* ]]; then + echo "npm_tag=next" >> "$GITHUB_OUTPUT" + echo "Publishing pre-release $VERSION to @next" + else + echo "npm_tag=latest" >> "$GITHUB_OUTPUT" + echo "Publishing $VERSION to @latest" + fi + + # Authentication via OIDC trusted publisher (configured on npmjs.com). + # No NPM_TOKEN needed. + - run: npm publish --provenance --access public --tag ${{ steps.dist_tag.outputs.npm_tag }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 739761b..3daa51d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -69,10 +69,14 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '22' cache: 'npm' registry-url: 'https://registry.npmjs.org' + # Upgrade npm to a version that supports OIDC trusted publishing (>= 11.5.1) + - name: Upgrade npm for OIDC trusted publishing + run: npm install -g npm@latest + - name: Install dependencies run: npm ci @@ -93,10 +97,10 @@ jobs: echo "Publishing $TAG to @latest" fi + # Authentication via OIDC trusted publisher (configured on npmjs.com). + # No NPM_TOKEN needed. - name: Publish to npm run: npm publish --provenance --access public --tag ${{ steps.dist_tag.outputs.npm_tag }} - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Create GitHub Release uses: softprops/action-gh-release@v1 diff --git a/package-lock.json b/package-lock.json index 9955f02..d403b44 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "squads-cli", - "version": "0.3.0", + "version": "0.3.0-rc.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "squads-cli", - "version": "0.3.0", + "version": "0.3.0-rc.1", "license": "MIT", "dependencies": { "@anthropic-ai/sdk": "^0.71.2", diff --git a/package.json b/package.json index 2ffa510..a0d4703 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "squads-cli", - "version": "0.3.0", + "version": "0.3.0-rc.1", "description": "Your AI workforce. Every user gets an AI manager that runs their team — finance, marketing, engineering, operations — for the cost of API calls.", "type": "module", "bin": {