From 4eb3dbf492c645e9ccefe7e6bd72d62eafae066c Mon Sep 17 00:00:00 2001 From: Shantur Rathore Date: Fri, 21 Nov 2025 20:54:59 +0000 Subject: [PATCH] Route npm publish through reusable workflow --- .github/workflows/dev-release.yml | 40 +++--------------------- .github/workflows/manual-npm-publish.yml | 14 ++++++++- .github/workflows/release.yml | 36 +++------------------ 3 files changed, 21 insertions(+), 69 deletions(-) diff --git a/.github/workflows/dev-release.yml b/.github/workflows/dev-release.yml index eee5a8c4..82772a01 100644 --- a/.github/workflows/dev-release.yml +++ b/.github/workflows/dev-release.yml @@ -58,39 +58,7 @@ jobs: publish-server: needs: prepare-dev - runs-on: ubuntu-latest - permissions: - contents: read - id-token: write - env: - NODE_VERSION: 20 - VERSION: ${{ needs.prepare-dev.outputs.version }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - cache: npm - registry-url: https://registry.npmjs.org - - - name: Set workspace versions - run: npm version ${VERSION} --workspaces --include-workspace-root --no-git-tag-version --allow-same-version - - - name: Install dependencies - run: npm ci --workspaces - - - name: Ensure rollup native binary - run: npm install @rollup/rollup-linux-x64-gnu --no-save - - - name: Build server package - run: npm run build --workspace @neuralnomads/codenomad - - - name: Publish server package to dev tag - env: - NPM_CONFIG_PROVENANCE: true - NPM_CONFIG_REGISTRY: https://registry.npmjs.org - NPM_CONFIG_ALWAYS_AUTH: true - run: npm publish --workspace @neuralnomads/codenomad --access public --tag dev --provenance + uses: ./.github/workflows/manual-npm-publish.yml + with: + dist_tag: dev + secrets: inherit diff --git a/.github/workflows/manual-npm-publish.yml b/.github/workflows/manual-npm-publish.yml index 9bf37ffe..d67647ca 100644 --- a/.github/workflows/manual-npm-publish.yml +++ b/.github/workflows/manual-npm-publish.yml @@ -2,6 +2,18 @@ name: Manual NPM Publish on: workflow_dispatch: + inputs: + dist_tag: + description: "npm dist-tag" + required: false + default: dev + type: string + workflow_call: + inputs: + dist_tag: + required: false + type: string + default: dev permissions: contents: read @@ -38,7 +50,7 @@ jobs: run: | VERSION=$(node -p "require('./package.json').version") echo "VERSION=$VERSION" >> "$GITHUB_ENV" - echo "DIST_TAG=dev" >> "$GITHUB_ENV" + echo "DIST_TAG=${{ inputs.dist_tag || 'dev' }}" >> "$GITHUB_ENV" - name: Publish server package with provenance env: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e239b207..56839fce 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -75,35 +75,7 @@ jobs: publish-server: needs: prepare-release - runs-on: ubuntu-latest - permissions: - contents: read - id-token: write - env: - NODE_VERSION: 20 - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - cache: npm - registry-url: https://registry.npmjs.org - - - name: Install dependencies - run: npm ci --workspaces - - - name: Ensure rollup native binary - run: npm install @rollup/rollup-linux-x64-gnu --no-save - - - name: Build server package - run: npm run build --workspace @neuralnomads/codenomad - - - name: Publish server package - env: - NPM_CONFIG_PROVENANCE: true - NPM_CONFIG_REGISTRY: https://registry.npmjs.org - NPM_CONFIG_ALWAYS_AUTH: true - run: npm publish --workspace @neuralnomads/codenomad --access public --tag latest --provenance + uses: ./.github/workflows/manual-npm-publish.yml + with: + dist_tag: latest + secrets: inherit