Route npm publish through reusable workflow

This commit is contained in:
Shantur Rathore
2025-11-21 20:54:59 +00:00
parent adbe0399b2
commit 4eb3dbf492
3 changed files with 21 additions and 69 deletions

View File

@@ -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

View File

@@ -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:

View File

@@ -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