Route npm publish through reusable workflow
This commit is contained in:
40
.github/workflows/dev-release.yml
vendored
40
.github/workflows/dev-release.yml
vendored
@@ -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
|
||||
|
||||
14
.github/workflows/manual-npm-publish.yml
vendored
14
.github/workflows/manual-npm-publish.yml
vendored
@@ -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:
|
||||
|
||||
36
.github/workflows/release.yml
vendored
36
.github/workflows/release.yml
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user