Route npm publish through reusable workflow
This commit is contained in:
38
.github/workflows/dev-release.yml
vendored
38
.github/workflows/dev-release.yml
vendored
@@ -58,39 +58,7 @@ jobs:
|
|||||||
|
|
||||||
publish-server:
|
publish-server:
|
||||||
needs: prepare-dev
|
needs: prepare-dev
|
||||||
runs-on: ubuntu-latest
|
uses: ./.github/workflows/manual-npm-publish.yml
|
||||||
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:
|
with:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
dist_tag: dev
|
||||||
cache: npm
|
secrets: inherit
|
||||||
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
|
|
||||||
|
|||||||
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:
|
on:
|
||||||
workflow_dispatch:
|
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:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
@@ -38,7 +50,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
VERSION=$(node -p "require('./package.json').version")
|
VERSION=$(node -p "require('./package.json').version")
|
||||||
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
|
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
|
- name: Publish server package with provenance
|
||||||
env:
|
env:
|
||||||
|
|||||||
34
.github/workflows/release.yml
vendored
34
.github/workflows/release.yml
vendored
@@ -75,35 +75,7 @@ jobs:
|
|||||||
|
|
||||||
publish-server:
|
publish-server:
|
||||||
needs: prepare-release
|
needs: prepare-release
|
||||||
runs-on: ubuntu-latest
|
uses: ./.github/workflows/manual-npm-publish.yml
|
||||||
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:
|
with:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
dist_tag: latest
|
||||||
cache: npm
|
secrets: inherit
|
||||||
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
|
|
||||||
|
|||||||
Reference in New Issue
Block a user