ci: automate npm publish (#305)
Add a workflow that performs the publishing when a new Git tag is pushed.development
parent
eb1e866ede
commit
41a3fbfd55
|
@ -1,6 +1,11 @@
|
||||||
name: 'Build Setup'
|
name: 'Build Setup'
|
||||||
description: 'Setup node and install dependencies'
|
description: 'Setup node and install dependencies'
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
registry-url:
|
||||||
|
description: 'Optional registry to set up for auth.'
|
||||||
|
required: false
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'composite'
|
using: 'composite'
|
||||||
steps:
|
steps:
|
||||||
|
@ -8,6 +13,7 @@ runs:
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
|
registry-url: ${{ inputs.registry-url }}
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
uses: bahmutov/npm-install@v1
|
uses: bahmutov/npm-install@v1
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
name: Publish NPM Package
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- v*
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
permissions:
|
||||||
|
# required for "npm provenance"
|
||||||
|
id-token: write
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Build Setup
|
||||||
|
uses: ./.github/actions/build-setup
|
||||||
|
with:
|
||||||
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
# scoped package requires "access=public"
|
||||||
|
- run: npm publish -w packages/core --provenance --access public
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
@ -56,6 +56,9 @@ git tag v0.2.0
|
||||||
|
|
||||||
## Publish the npm package
|
## Publish the npm package
|
||||||
|
|
||||||
|
The package is published automatically once the Git tag is pushed thanks to a [GitHub workflow](https://github.com/maxGraph/maxgraph-integration-examples/actions/workflows/publish-npm-package.yml).
|
||||||
|
|
||||||
|
If its execution fails, and you want to publish the package manually:
|
||||||
- Checkout the tag that has just been created
|
- Checkout the tag that has just been created
|
||||||
- From packages/core:
|
- From packages/core:
|
||||||
- run `npm publish`
|
- run `npm publish`
|
||||||
|
|
Loading…
Reference in New Issue